Add warning to members applying with gmail to whitelist
[hcoop/portal.git] / balance.sml
index 505cf47..59622de 100644 (file)
@@ -97,15 +97,19 @@ fun listBalanceUsers bal =
 
 fun sumOwnedBalances () =
     case C.oneRow (getDb ()) ($`SELECT SUM(amount)
-                               FROM Balance JOIN WebUser
-                                 ON Balance.name = WebUser.name
-                                   AND WebUser.bal = Balance.id`) of
+                               FROM Balance JOIN WebUser
+                                 ON Balance.name = WebUser.name
+                                   AND WebUser.bal = Balance.id
+                               JOIN Membership
+                                 ON Membership.usr = WebUser.id
+                                   AND Membership.grp = 1`) of
        [amt] => C.realFromSql amt
       | _ => raise Fail "sumOwnedBalance: no rows"
 
 fun isNegative (bal : balance) = #amount bal < 0.0
 
-fun depositAmount bal =
+fun depositAmount _ = 7.0 * 3.0
+(*fun depositAmount bal =
     let
        val db = getDb ()
 
@@ -113,11 +117,7 @@ fun depositAmount bal =
                              [n] => C.intFromSql n
                            | row => Init.rowError ("Bad depositAmount share count result", row)
     in
-       case C.oneRow db ($`SELECT 3.0 * 900.0 * SUM(shares) / ^(C.intToSql totalShares)
-                           FROM WebUserPaying
-                           WHERE bal = ^(C.intToSql bal)`) of
-           [amount] => C.realFromSql amount
-         | row => Init.rowError ("Bad depositAmount result", row)
-    end
+       3.0 * 900.0 / real totalShares
+    end*)
 
 end