web: add configurable membership fees
This commit is contained in:
parent
d2e9d16c7b
commit
af58b41cbd
3 changed files with 12 additions and 15 deletions
|
@ -20,6 +20,11 @@ class Config(object):
|
|||
CACHE_TYPE = 'null'
|
||||
CACHE_NO_NULL_WARNING = True
|
||||
|
||||
MEMBERSHIP_FEES = {
|
||||
'starving': 75,
|
||||
'fatty': 150,
|
||||
}
|
||||
|
||||
class DevelopmentConfig(Config):
|
||||
DEBUG = True
|
||||
DISABLE_LDAP = True
|
||||
|
|
|
@ -234,10 +234,7 @@ class Member(db.Model):
|
|||
previous_scalar = self._yearmonth_scalar(previous_transfer)
|
||||
unpaid_months += (now - previous_scalar)
|
||||
|
||||
fees = {
|
||||
'starving': 50,
|
||||
'fatty': 100,
|
||||
}
|
||||
fees = app.config['MEMBERSHIP_FEES']
|
||||
|
||||
status['months_due'] = unpaid_months
|
||||
status['money_due'] = fees.get(self.type, 0) * unpaid_months
|
||||
|
@ -406,12 +403,11 @@ class Transfer(db.Model):
|
|||
if title[2]:
|
||||
return self.MATCH_WRONG_TYPE, member, 0
|
||||
|
||||
if title[1] == 'starving' and self.amount >= (50*100) and (self.amount % (50*100)) == 0:
|
||||
return self.MATCH_OK, member, int(self.amount/(50*100))
|
||||
|
||||
if title[1] == 'fatty' and self.amount >= (100*100) and (self.amount % (100*100)) == 0:
|
||||
return self.MATCH_OK, member, int(self.amount/(100*100))
|
||||
fees = app.config['MEMBERSHIP_FEES']
|
||||
|
||||
for type_name, type_amount in fees.items():
|
||||
if title[1] == type_name and self.amount >= (type_amount*100) and (self.amount % (type_amount*100)) == 0:
|
||||
return self.MATCH_OK, member, int(self.amount/(type_amount*100))
|
||||
|
||||
return self.MATCH_WRONG_TYPE, member, 0
|
||||
|
||||
|
|
|
@ -34,12 +34,8 @@
|
|||
</h3>
|
||||
</div>
|
||||
{% if matchability == 1 %}
|
||||
<!--<div class="panel-body">
|
||||
</div>
|
||||
-->
|
||||
|
||||
{% set fattycount = t.amount/10000 %}
|
||||
{% set starvingcount = t.amount/5000 %}
|
||||
{% set fattycount = t.amount/(config['MEMBERSHIP_FEES']['fatty'] * 100) %}
|
||||
{% set starvingcount = t.amount/(config['MEMBERSHIP_FEES']['starving'] * 100) %}
|
||||
|
||||
<div class="list-group">
|
||||
<a href="javascript:payment(1, '{{t.uid}}', '{{ extra.username }}')" class="list-group-item">This is a one-time payment.</a>
|
||||
|
|
Loading…
Reference in a new issue