Only call member.save() when there's a change
This commit is contained in:
parent
0a7bb7e963
commit
fddb4e1c1a
|
@ -134,6 +134,7 @@ 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)
|
||||||
|
|
||||||
|
if member.expire_date != expire_date or member.status != status:
|
||||||
member.expire_date = expire_date
|
member.expire_date = expire_date
|
||||||
member.status = status
|
member.status = status
|
||||||
|
|
||||||
|
@ -141,6 +142,10 @@ def tally_membership_months(member, fake_date=None):
|
||||||
member.paused_date = expire_date
|
member.paused_date = expire_date
|
||||||
|
|
||||||
member.save()
|
member.save()
|
||||||
|
logging.debug('Tallied %s: updated.', member)
|
||||||
|
else:
|
||||||
|
logging.debug('Tallied %s: no changes.', member)
|
||||||
|
|
||||||
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