Skip to content

Instantly share code, notes, and snippets.

@JKring
Created May 8, 2013 00:36
Show Gist options
  • Save JKring/5537343 to your computer and use it in GitHub Desktop.
Save JKring/5537343 to your computer and use it in GitHub Desktop.
this was to rectify mislabeled prescreen payments
misc_writers = Hash.new(0)
adj_writers = []
b.finished_jobs.each do |f|
p = Payment.where("prescreened_jobs.#{ f.id }" => {"$ne" => nil }).first
if p
unless p.prescreened_jobs[f.id.to_s] == 15
if p.paid
current_p = Payment.current(p.writer)
adding = (15 - p.prescreened_jobs[f.id.to_s])
current_p.misc += adding
current_p.save
misc_writers[p.writer.email] = misc_writers[p.writer.email] + adding
else
p.prescreened_jobs[f.id.to_s] = 15
p.save
adj_writers << p.writer.email
end
end
end
end
adj_writers.uniq!
puts "Misc Additions"
misc_writers.each_pair do |e, p|
puts "#{ e }: #{ p }"
end
puts "Adjusted Payments"
puts adj_writers.join ", "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment