Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jiji14 committed Dec 12, 2023
1 parent fdf03c2 commit 7e87462
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions emission/core/wrapper/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,17 +244,20 @@ def updateModes(self, updated_mode):
new_mode = updated_mode['new_mode']
is_new_mode_must_added = updated_mode['is_new_mode_must_added']

# when a user changed a mode to an exsiting customized mode
if new_mode in modes:
updated_frequency = modes[new_mode]['frequency'] + 1
modes[new_mode]['frequency'] = updated_frequency

# when a user added a new customized mode
if is_new_mode_must_added and not new_mode in modes:
modes[new_mode] = {
'createdAt': datetime.now(),
'frequency': 1,
'isActive': True,
}

# when a user chaged a mode from an exsiting customized mode
if old_mode in modes:
updated_frequency = modes[old_mode]['frequency'] - 1
modes[old_mode]['frequency'] = updated_frequency
Expand Down

0 comments on commit 7e87462

Please sign in to comment.