-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/acknowledged by showed in task logs #721
Feature/acknowledged by showed in task logs #721
Conversation
Signed-off-by: angatupyry <[email protected]>
Signed-off-by: angatupyry <[email protected]>
Signed-off-by: angatupyry <[email protected]>
Signed-off-by: angatupyry <[email protected]>
Signed-off-by: angatupyry <[email protected]>
Signed-off-by: angatupyry <[email protected]>
Signed-off-by: angatupyry <[email protected]>
Signed-off-by: angatupyry <[email protected]>
Codecov Report
@@ Coverage Diff @@
## main #721 +/- ##
==========================================
- Coverage 57.73% 57.62% -0.11%
==========================================
Files 293 293
Lines 6733 6757 +24
Branches 884 884
==========================================
+ Hits 3887 3894 +7
- Misses 2657 2674 +17
Partials 189 189
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So far so good! It works as expected, just have a couple of comments.
Perhaps we should pass in a TaskRepository
instance instead of creating one every time we acknowledge an alert. If it is not passed in, we can use the user of this alert repository to create a task repository too
class AlertRepository:
def __init__(self, user: User, task_repo: TaskRepository = None):
self.user = user
self.task_repo = task_repo if task_repo is not None else TaskRepository(self.user)
task_repo = TaskRepository(user) | ||
|
||
# Save in logs who was the user that acknowledged the task | ||
await task_repo.save_log_acknowledged_task_completion( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await task_repo.save_log_acknowledged_task_completion( | |
await self.task_repo.save_log_acknowledged_task_completion( |
with the suggestion in the main review comment, we can remove the construction of task_repo
in the few lines before this, and just use self.task_repo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Self
here is AlertRepository
and I don't have access to task_repo
. What I could do is self.user
but I make the instance of User
to make sure it is admin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh! self.task_repo
would refer to the TaskRepository
that is passed in during construction, take a look at the example code block I provided in the main review comment
class AlertRepository:
def __init__(self, user: User, task_repo: TaskRepository = None):
self.user = user
self.task_repo = task_repo if task_repo is not None else TaskRepository(self.user)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
task_repo
can be passed into alert_repo
here, https://github.com/open-rmf/rmf-web/blob/feature/acknowledged_by-showed-in-task-logs/packages/api-server/api_server/routes/internal.py#L15
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha!
Sorry for my misunderstanding!
Done here! c2cd6e7
Signed-off-by: angatupyry <[email protected]>
Signed-off-by: angatupyry <[email protected]>
Signed-off-by: angatupyry <[email protected]>
Signed-off-by: angatupyry <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Take a look at my follow up comments, let me know what you think!
Signed-off-by: angatupyry <[email protected]>
Signed-off-by: angatupyry <[email protected]>
@aaronchongth I also added those lines, please take a look |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, thanks for handling the dependencies too! LGTM
What's new
acknowledged by
in logs as a new value of phasesacknowledged by
in task state as a new value of phaseschrome-capture-2023-5-20.webm
chrome-capture-2023-5-20.2.webm
Self-checks
Discussion