From a426ec94346e77afdd1ce2848218da962264075c Mon Sep 17 00:00:00 2001 From: sqlcoder Date: Sat, 13 Dec 2008 01:15:25 +0000 Subject: [PATCH] include antes in net profit calculation --- pyfpdb/FpdbSQLQueries.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pyfpdb/FpdbSQLQueries.py b/pyfpdb/FpdbSQLQueries.py index f5b4f400..fc2c8d69 100644 --- a/pyfpdb/FpdbSQLQueries.py +++ b/pyfpdb/FpdbSQLQueries.py @@ -711,8 +711,9 @@ class FpdbSQLQueries: ( select # profit from handsplayers/handsactions hprof.gameTypeId, sum(hprof.profit) sum_profit from - (select hp.handId, h.gameTypeId, hp.winnings, SUM(ha.amount) - costs, hp.winnings - SUM(ha.amount) profit + (select hp.handId, h.gameTypeId, hp.winnings, + coalesce(hp.ante,0) + SUM(ha.amount) costs, + hp.winnings - (coalesce(hp.ante,0) + SUM(ha.amount)) profit from HandsPlayers hp inner join Hands h ON h.id = hp.handId inner join HandsActions ha ON ha.handPlayerId = hp.id