[HCoop-Discuss] [docelic, ntk] Cracking down on negative balances

Nathan Kennedy ntk at hcoop.net
Wed Feb 20 21:16:33 EST 2008


docelic wrote:
> On Wed, Feb 20, 2008 at 07:39:26PM -0500, Adam Chlipala wrote:
>   
>> Nathan Kennedy wrote:
>>
>>     
>>> I think that our system should, for any member whose (new sense) balance 
>>> reaches zero, should automatically reduce their pledge level to 1 
>>> immediately,
>>>       
>> This is a great idea. Too bad that it requires some additions to the 
>> portal, but I think it's worth doing. :-)
>>     
>
> Oh definitely, please do.
My ML is extremely rusty, and I was an OCaML guy anyway, but rather than 
have Adam do _everything_ with the portal I thought I'd give it a poke.

Isn't all you have to do is change this in init.sml:
fun modUser (user : user) =
...
                               shares = ^(C.intToSql (#shares user))
to this:
shares = ^(C.intToSql(if (#bal user) <= 0 then 1 else (#shares user)))

or something like that?  My syntax may be off.  Not much of an 
"addition" but seems to do the trick nicely.

-ntk



More information about the HCoop-Discuss mailing list