Add delete links on poll pages
[bpt/portal.git] / remind / remind.sml
index 64afa0c..fe7edee 100644 (file)
@@ -11,6 +11,9 @@ fun printReal n =
     else
        Real.fmt (StringCvt.FIX (SOME 2)) n
 
+val basePerMonth = 5.0
+val deposit = basePerMonth * 3.0
+
 fun main _ =
     let
        val db = C.conn dbstring
@@ -26,9 +29,8 @@ fun main _ =
                val shares = C.intFromSql shares
                val amount = C.realFromSql amount
 
-               val perMonth = 900.0 * real shares / real totalShares
-               val deposit = perMonth * 3.0
-               val headsUp = perMonth * 5.0
+               val perMonth = basePerMonth * real shares
+               val headsUp = deposit + perMonth * 2.0
            in
                if amount >= headsUp then
                    ()
@@ -75,10 +77,7 @@ fun main _ =
                        write "\nMinimum amount to pay to not see this message again for two months: US$";
                        write (printReal (headsUp - amount));
 
-                       write "\n\nYour deposit requirement was calculated by dividing our total monthly expenses\n";
-                       write "($900) by the sum of all members' pledge amounts, multiplying by your pledge amount,\n";
-                       write "and then multiplying by 3.  That is, the amount covers your share of three months'\n";
-                       write "expenses.\n\n";
+                       write "\n\nThe deposit requirement was calculated as three months of dues at $5/mo..\n\n";
 
                        write "To make a payment, visit:\n";
                        write "     https://members.hcoop.net/\n";
@@ -86,15 +85,13 @@ fun main _ =
 
                        write "\nIf for whatever reason you don't plan to pay the amount suggested in this e-mail,\n";
                        write "_please_ don't stay silent.  Reply to this message explaining your circumstances.\n";
-                       write "We are doing limited-time monetary grants on request, due to the extra costs\n";
-                       write "associated with setting up our new servers.\n";
 
                        ignore (Mail.mclose m)
                    end
            end
          | doOne _ = raise Fail "Bad SQL row"
     in
-       C.app db doOne "SELECT Balance.name, COUNT(*), SUM(WebUserPaying.shares) AS shrs, Balance.amount FROM WebUserPaying JOIN Balance ON WebUserPaying.bal = Balance.id GROUP BY Balance.name, Balance.amount HAVING amount < 10";
+       C.app db doOne ("SELECT Balance.name, COUNT(*), SUM(WebUserPaying.shares) AS shrs, Balance.amount FROM WebUserPaying JOIN Balance ON WebUserPaying.bal = Balance.id GROUP BY Balance.name, Balance.amount HAVING amount < " ^ C.realToSql deposit ^ " + " ^ C.realToSql (basePerMonth * 2.0) ^ " * SUM(WebUserPaying.shares)");
        C.close db;
        OS.Process.success
     end handle C.Sql s => (print ("SQL failure: " ^ s ^ "\n");