Statistics
| Branch: | Tag: | Revision:

root / db / CreditAllocator.py @ 45088a2d

History | View | Annotate | Download (383 Bytes)

1
#
2
#
3
#
4

    
5
from db.models import *
6

    
7
# main entry point
8
def main():
9
    all_users = OceanUser.objects.all()
10

    
11
    for u in all_users:
12
        if u.credit < u.quota:
13
            u.credit = u.credit + u.monthly_rate
14
        if u.credit > u.quota:
15
            u.credit = u.quota
16
        print "Add %d credits to %s. Total: %d" % ( u.monthly_rate, u.name, u.credit )
17
        u.save()
18

    
19
#
20
main()