Merge branch 'master' into budget

This commit is contained in:
kikito
2016-11-28 11:41:49 +01:00
219 changed files with 3311 additions and 1189 deletions

View File

@@ -5,7 +5,7 @@ module ActsAsParanoidAliases
def hide
return false if hidden?
update_attribute(:hidden_at, Time.now)
update_attribute(:hidden_at, Time.current)
after_hide
end
@@ -21,7 +21,7 @@ module ActsAsParanoidAliases
end
def confirm_hide
update_attribute(:confirmed_hide_at, Time.now)
update_attribute(:confirmed_hide_at, Time.current)
end
def restore(opts={})

View File

@@ -21,7 +21,7 @@ class EmailDigest
end
def mark_as_emailed
notifications.update_all(emailed_at: Time.now)
notifications.update_all(emailed_at: Time.current)
end
end
end

View File

@@ -11,7 +11,7 @@ module ScoreCalculator
score = ups - downs
offset = Math.log([score.abs, 1].max, 10) * (ups / [total, 1].max)
sign = score <=> 0
seconds = ((date || Time.now) - EPOC).to_f
seconds = ((date || Time.current) - EPOC).to_f
(((offset * sign) + (seconds/TIME_UNIT)) * 10000000).round
end

View File

@@ -13,4 +13,4 @@ namespace :comments do
end
end
end
end

View File

@@ -1,4 +1,5 @@
namespace :proposals do
desc "Updates all proposals by recalculating their hot_score"
task touch: :environment do
Proposal.find_in_batches do |proposals|
@@ -6,4 +7,4 @@ namespace :proposals do
end
end
end
end

View File

@@ -1,4 +1,5 @@
namespace :spending_proposals do
desc "Sends an email to the authors of unfeasible spending proposals"
task send_unfeasible_emails: :environment do
SpendingProposal.find_each do |spending_proposal|
@@ -18,4 +19,4 @@ namespace :spending_proposals do
end
end
end
end

View File

@@ -76,4 +76,12 @@ namespace :users do
task remove_erased_identities: :environment do
Identity.joins(:user).where('users.erased_at IS NOT NULL').destroy_all
end
end
desc "Update password changed at for existing users"
task update_password_changed_at: :environment do
User.all.each do |user|
user.update(password_changed_at: user.created_at)
end
end
end