This repository was archived by the owner on Sep 16, 2022. It is now read-only.
Allow users to check off recommended actions they've done#485
Merged
vpetersson merged 5 commits intoWoTTsecurity:masterfrom Oct 23, 2019
Merged
Allow users to check off recommended actions they've done#485vpetersson merged 5 commits intoWoTTsecurity:masterfrom
vpetersson merged 5 commits intoWoTTsecurity:masterfrom
Conversation
Contributor
|
Please use Enum with readable names instead of unreadable RECOMMENDED_ACTION_IDS and its indices. |
backend/device_registry/models.py
Outdated
| def snooze_action(self, action_id): | ||
| snoozed_actions = set(self.snoozed_actions) | ||
| snoozed_actions.add(action_id) | ||
| self.snoozed_actions = list(snoozed_actions) |
Contributor
There was a problem hiding this comment.
you could simply check if action_id not in self.snoozed_actions
backend/device_registry/models.py
Outdated
| self.title = title | ||
| self.description = description | ||
| self.actions = actions | ||
| self.info = info |
Contributor
There was a problem hiding this comment.
There is no docstring describing what kind of data should this info field have. Also this name is not informative. And why isn't it two fields (action_id, devices) instead? And is the id field used anywhere?
1. Replaces RECOMMENDED_ACTION_IDS list with an Enum class 2. 'snooze_action' method's code simplified 3. got rid of the 'id' 'Action' class' property 4. renamed the 'info' 'Action' class' property to 'snoozing_info'
a-martynovich
approved these changes
Oct 23, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #453