Skip to content

Commit

Permalink
Add display of total debts.
Browse files Browse the repository at this point in the history
  • Loading branch information
Unknown authored and knielsen committed Apr 5, 2015
1 parent 145242f commit d5d4a73
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drinkomatic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,11 @@ local function main_menu()

local r = assert(db:fetchone(
"SELECT SUM(balance)/COUNT(1), MIN(balance) FROM users"))
local s = assert(db:fetchone(
"SELECT SUM(balance) FROM users WHERE balance < 0"))
print(" Average balance: %16.2f DKK", r[1])
print(" Largest single debt: %16.2f DKK", r[2])
print(" Total debt: %16.2f DKK", s[1])
end

local function user_menu()
Expand Down

0 comments on commit d5d4a73

Please sign in to comment.