Skip to content

Instantly share code, notes, and snippets.

@shipiev
Created September 30, 2015 15:12
Show Gist options
  • Save shipiev/5b208368297aac148727 to your computer and use it in GitHub Desktop.
Save shipiev/5b208368297aac148727 to your computer and use it in GitHub Desktop.
logins = %i{zabrovskiy lisichkin serkin sokorev romnychev minzhynkov mescheryakova shipiev svyatskaya bykovchenko}
logins.inject do |result, login|
user_id = User.where(login: login).first.id
issues = Issue.where(assigned_to_id: user_id, fixed_version_id: 2279).
spent_full =
issues.joins(:time_entries).where('time_entries.created_on >= DATE("2015-09-15")').
pluck('SUM(time_entries.hours) AS sum_hours').first
est = issues.pluck('SUM(issues.estimated_hours) AS est_hours').first
coef = est.to_f/spent_full.to_f
result.merge login => {coef: coef, est: est, spent_full: spent_full}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment