Skip to content

Commit bd4ad1b

Browse files
committed
creating check to see port status
1 parent ec42a53 commit bd4ad1b

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

app/models/protip.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def cacluate_score
8383
end
8484

8585
def generate_public_id
86-
return self.public_id if self.public_id
86+
return self.public_id if self.public_id.present?
8787
self.public_id = SecureRandom.urlsafe_base64(4).downcase
8888
#retry if not unique
8989
generate_public_id unless Protip.where(public_id: self.public_id).blank?

lib/tasks/db.rake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,16 @@ namespace :db do
6464
end
6565

6666
namespace :port do
67+
68+
task :check => :connect do
69+
puts "legacy => ported"
70+
puts "Likes: #{Legacy[:likes]} => #{Like.count}"
71+
puts "Comments: #{Legacy[:comments]} => #{Comment.count}"
72+
puts "Protips: #{Legacy[:protips]} => #{Protip.count}"
73+
puts "Badges: #{Legacy[:badges]} => #{Badge.count}"
74+
puts "Users: #{Legacy[:users]} => #{User.count}"
75+
end
76+
6777
task :connect => :environment do
6878
if hide_sql_out = Rails.env.development?
6979
ActiveRecord::Base.logger.level = Logger::INFO

0 commit comments

Comments
 (0)