Add "joined this month" annotations in bootworthy list
authorAdam Chlipala <adamc@hcoop.net>
Sat, 31 May 2008 17:42:32 +0000 (17:42 +0000)
committerAdam Chlipala <adamc@hcoop.net>
Sat, 31 May 2008 17:42:32 +0000 (17:42 +0000)
money.mlt
money.sig
money.sml

index 8ca3486..7156f95 100644 (file)
--- a/money.mlt
+++ b/money.mlt
@@ -588,7 +588,8 @@ elseif $"cmd" = "freezeworthy" then
 <table>
 <tr> <th>Member</th> <th>Balance</th> </tr>
 <% foreach dq in dqs do %>
-<tr> <td><a href="user?id=<% #id dq %>"><% #name dq %></a></td> <td>$<% #balance dq %></td> </tr>
+<tr> <td><a href="user?id=<% #id dq %>"><% #name dq %></a></td> <td>$<% #balance dq %></td>
+<% if #joinedThisMonth dq then %><td><i>(joined this month)</i></td><% end %></tr>
 <% end %>
 </table>
 
index 511d50c..4195a87 100644 (file)
--- a/money.sig
+++ b/money.sig
@@ -38,7 +38,7 @@ sig
     val resetPledges : int list -> unit
 
     val freezeworthyPledgers : unit -> { id : int, name : string, balance : real, joinedThisMonth : bool } list
-    val bootworthyPledgers : unit -> { id : int, name : string, balance : real } list
+    val bootworthyPledgers : unit -> { id : int, name : string, balance : real, joinedThisMonth : bool } list
 
     val billDues : {descr : string, base : real, date : string} -> unit
 end
index 6701459..1ca22a2 100644 (file)
--- a/money.sml
+++ b/money.sml
@@ -313,11 +313,11 @@ fun bootworthyPledgers () =
     let
        val baseDues = 5.0
 
-       fun makeRow [id, name, amount] = {id = C.intFromSql id, name = C.stringFromSql name,
-                                         balance = C.realFromSql amount}
+       fun makeRow [id, name, amount, j] = {id = C.intFromSql id, name = C.stringFromSql name,
+                                            balance = C.realFromSql amount, joinedThisMonth = C.boolFromSql j}
          | makeRow row = Init.rowError ("Bad bootworthyPledgers", row)
     in
-       C.map (getDb ()) makeRow ($`SELECT WebUserPaying.id, WebUserPaying.name, amount
+       C.map (getDb ()) makeRow ($`SELECT WebUserPaying.id, WebUserPaying.name, amount, CURRENT_TIMESTAMP - joined < INTERVAL '1 month'
                                    FROM WebUserPaying JOIN Balance ON Balance.id = bal
                                    WHERE amount < ^(C.realToSql baseDues) * ^(C.intToSql graceMonths)
                                    ORDER BY name`)