Only call member.save() when there's a change
This commit is contained in:
parent
0a7bb7e963
commit
fddb4e1c1a
|
@ -134,13 +134,18 @@ def tally_membership_months(member, fake_date=None):
|
||||||
expire_date = add_months(start_date, total_months)
|
expire_date = add_months(start_date, total_months)
|
||||||
status = calc_member_status(expire_date, fake_date)
|
status = calc_member_status(expire_date, fake_date)
|
||||||
|
|
||||||
member.expire_date = expire_date
|
if member.expire_date != expire_date or member.status != status:
|
||||||
member.status = status
|
member.expire_date = expire_date
|
||||||
|
member.status = status
|
||||||
|
|
||||||
if status == 'Former Member':
|
if status == 'Former Member':
|
||||||
member.paused_date = expire_date
|
member.paused_date = expire_date
|
||||||
|
|
||||||
|
member.save()
|
||||||
|
logging.debug('Tallied %s: updated.', member)
|
||||||
|
else:
|
||||||
|
logging.debug('Tallied %s: no changes.', member)
|
||||||
|
|
||||||
member.save()
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -250,7 +250,7 @@ LOGGING = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
'root': {
|
'root': {
|
||||||
'level': 'INFO',
|
'level': 'DEBUG' if DEBUG else 'INFO',
|
||||||
'handlers': ['console'],
|
'handlers': ['console'],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user