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)
|
||||
status = calc_member_status(expire_date, fake_date)
|
||||
|
||||
if member.expire_date != expire_date or member.status != status:
|
||||
member.expire_date = expire_date
|
||||
member.status = status
|
||||
|
||||
|
@ -141,6 +142,10 @@ def tally_membership_months(member, fake_date=None):
|
|||
member.paused_date = expire_date
|
||||
|
||||
member.save()
|
||||
logging.debug('Tallied %s: updated.', member)
|
||||
else:
|
||||
logging.debug('Tallied %s: no changes.', member)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
|
|
|
@ -250,7 +250,7 @@ LOGGING = {
|
|||
},
|
||||
},
|
||||
'root': {
|
||||
'level': 'INFO',
|
||||
'level': 'DEBUG' if DEBUG else 'INFO',
|
||||
'handlers': ['console'],
|
||||
},
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user