mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 21:32:15 +01:00
implemented function to calculate changes
This commit is contained in:
parent
af0736d068
commit
49141bccc6
1 changed files with 19 additions and 0 deletions
|
|
@ -70,6 +70,25 @@ def create_local_settings_handler():
|
|||
return MongoLocalSettingsHandler()
|
||||
|
||||
|
||||
def calculate_changes(old_value, new_value):
|
||||
changes = {}
|
||||
for key, value in new_value.items():
|
||||
if key not in old_value:
|
||||
changes[key] = value
|
||||
continue
|
||||
|
||||
_value = old_value[key]
|
||||
if isinstance(value, dict) and isinstance(_value, dict):
|
||||
_changes = calculate_changes(_value, value)
|
||||
if _changes:
|
||||
changes[key] = _changes
|
||||
continue
|
||||
|
||||
if _value != value:
|
||||
changes[key] = value
|
||||
return changes
|
||||
|
||||
|
||||
@require_handler
|
||||
def save_studio_settings(data):
|
||||
return _SETTINGS_HANDLER.save_studio_settings(data)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue