payment: note that Stripe has instituted an additional 1% fee for non-US cards
[hcoop/portal.git] / location.sml
index 5dbf7a6..f59059a 100644 (file)
@@ -102,7 +102,7 @@ fun countResidents () =
                addToParents (#loc lives, count)
            end
     in
-       C.fold db folder NM.empty ($`SELECT loc, usr FROM Lives`)
+       C.fold db folder NM.empty ($`SELECT loc, usr FROM Lives JOIN WebUserActive ON usr = id`)
     end
 
 fun recordResidents () =
@@ -135,8 +135,8 @@ fun recordResidents () =
                addToParents (loc, count)
            end
     in
-       C.fold db folder NM.empty ($`SELECT loc, id, name, rname, bal, joined, app, shares
-                                    FROM Lives JOIN WebUser ON usr = id`)
+       C.fold db folder NM.empty ($`SELECT loc, id, name, rname, bal, joined, app, shares, paypal, checkout
+                                    FROM Lives JOIN WebUserActive ON usr = id`)
     end
 
 fun residents loc =
@@ -172,7 +172,7 @@ fun locationTree (root, lim) =
            in
                C.fold db folder acc ($`SELECT id, parent, name FROM Location
                                        WHERE parent ^(intOptToSqlCompare root)
-                                       ORDER BY name`)
+                                       ORDER BY name DESC`)
            end
     in
        locationTree' (root, lim, [])
@@ -207,7 +207,7 @@ fun locationTreeWithUser (root, lim, usr) =
                C.fold db folder acc ($`SELECT loc, id, parent, name
                                        FROM Location LEFT OUTER JOIN Lives ON (id = loc AND usr = ^(C.intToSql usr))
                                        WHERE parent ^(intOptToSqlCompare root)
-                                       ORDER BY name`)
+                                       ORDER BY name DESC`)
            end
     in
        locationTree' (root, lim, [])
@@ -244,7 +244,7 @@ fun locationTreeWithCounts (root, lim) =
                C.fold db folder acc ($`SELECT id, parent, name
                                        FROM Location
                                        WHERE parent ^(intOptToSqlCompare root)
-                                       ORDER BY name`)
+                                       ORDER BY name DESC`)
            end
     in
        locationTree' (root, lim, [])
@@ -293,10 +293,11 @@ fun removeFromLocation (lives : lives) =
     end
 
 fun residentsOneLevel loc =
-    C.map (getDb ()) mkUserRow ($`SELECT id, name, rname, bal, joined, app, shares FROM Lives, WebUser
-                                       WHERE loc = ^(C.intToSql loc)
-                                          AND usr = id
-                                       ORDER BY name`)
+    C.map (getDb ()) mkUserRow ($`SELECT id, name, rname, bal, joined, app, shares, paypal, checkout
+                                 FROM Lives, WebUserActive
+                                 WHERE loc = ^(C.intToSql loc)
+                                   AND usr = id
+                                 ORDER BY name`)
 
 fun alreadyExists (parent, name) =
     case C.oneRow (getDb ()) ($`SELECT COUNT( * ) FROM Location