Skip to content

Commit

Permalink
🐛 Fix caffeine calculation (closes #143)
Browse files Browse the repository at this point in the history
  • Loading branch information
YtvwlD committed Oct 20, 2023
1 parent 21e4629 commit dc784b3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/controllers/wrapped_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def most_bought_drink(audits, year)
end

def caffeine(audits)
total = audits.joins(:drink).sum(:caffeine)
total = audits.joins(:drink).sum("caffeine * (bottle_size / 0.1)")
if total.positive?
# for humans: overdose: 1000 mg, intoxication: 5000 mg
would_kill_kg = total / 192.0 # lethal dosage (mg) per kg
Expand Down

0 comments on commit dc784b3

Please sign in to comment.