From 7e87462c12358c9206e8da957ba31e2014165a3f Mon Sep 17 00:00:00 2001 From: Jijeong Lee Date: Tue, 12 Dec 2023 00:34:37 -0800 Subject: [PATCH] add comments --- emission/core/wrapper/user.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/emission/core/wrapper/user.py b/emission/core/wrapper/user.py index 1120bbac8..d693e2a33 100644 --- a/emission/core/wrapper/user.py +++ b/emission/core/wrapper/user.py @@ -244,10 +244,12 @@ 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(), @@ -255,6 +257,7 @@ def updateModes(self, updated_mode): '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