-
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
Date column in Tasks section #689
Date column in Tasks section #689
Conversation
Signed-off-by: fierro <[email protected]>
Signed-off-by: fierro <[email protected]>
Signed-off-by: fierro <[email protected]>
…is update Signed-off-by: fierro <[email protected]>
Signed-off-by: fierro <[email protected]>
Codecov Report
@@ Coverage Diff @@
## deploy/hammer #689 +/- ##
=================================================
- Coverage 59.30% 58.55% -0.75%
=================================================
Files 281 282 +1
Lines 5932 6093 +161
Branches 801 824 +23
=================================================
+ Hits 3518 3568 +50
- Misses 2260 2370 +110
- Partials 154 155 +1
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.
Upon going through it in detail, I believe we might not need to update rmf_api_msgs
, and the pydantic
model as well, just an additional field to the tortoise model is sufficient.
It looks like we just need to modify https://github.com/open-rmf/rmf-web/blob/main/packages/api-server/api_server/repositories/tasks.py#L29-L46, where instead of ttm.TaskState.update_or_create
, we can get_or_none, if it is not none, we copy the existing state's unix_millis_request_time
, and update the model with that same request time.
Otherwise, we create a new one with the current time stamp for the request time. We can be sure that the first state we get to save is right after the request has been dispatched, since it is saved in this post call and this post call
This approach should be used for the upcoming column of task initiator
too, using the dashboard's current user. Let me know what you think about this approach
Hey, Aaron. I think your approach is ok and that's exactly what I'm trying to do here
But I also need to update the |
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.
Doh! Thanks for explaining, I totally forgot that we are using the data
JSON field, we should fix that at some point, I'll add a backburner task for that.
I've left some comments and suggestions, let me know what you think
Signed-off-by: fierro <[email protected]>
Signed-off-by: fierro <[email protected]>
Signed-off-by: fierro <[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.
Thanks for the quick rework! Tested and working great, LGTM
* Add unix-millis-request-time field in taskstate Signed-off-by: fierro <[email protected]> * Generate taskstate model according to the rmf_api_msgs changes Signed-off-by: fierro <[email protected]> * Generate api client to get the new field Signed-off-by: fierro <[email protected]> * Save unix request time as now() and use previous value if the method is update Signed-off-by: fierro <[email protected]> * Show unix_millis_request_time in dashboard Signed-off-by: fierro <[email protected]> * Add Unix_millis_request_time into booking instead of taskstate directly Signed-off-by: fierro <[email protected]> * Access to unix_millis_request_time field through booking Signed-off-by: fierro <[email protected]> * Get previous task_state and if is not none use its request_time value Signed-off-by: fierro <[email protected]> --------- Signed-off-by: fierro <[email protected]> (cherry picked from commit 7ea986d) Signed-off-by: Aaron Chong <[email protected]>
* Date column in Tasks section (#689) * Add unix-millis-request-time field in taskstate Signed-off-by: fierro <[email protected]> * Generate taskstate model according to the rmf_api_msgs changes Signed-off-by: fierro <[email protected]> * Generate api client to get the new field Signed-off-by: fierro <[email protected]> * Save unix request time as now() and use previous value if the method is update Signed-off-by: fierro <[email protected]> * Show unix_millis_request_time in dashboard Signed-off-by: fierro <[email protected]> * Add Unix_millis_request_time into booking instead of taskstate directly Signed-off-by: fierro <[email protected]> * Access to unix_millis_request_time field through booking Signed-off-by: fierro <[email protected]> * Get previous task_state and if is not none use its request_time value Signed-off-by: fierro <[email protected]> --------- Signed-off-by: fierro <[email protected]> (cherry picked from commit 7ea986d) Signed-off-by: Aaron Chong <[email protected]> * Fix/request date export (#690) * Added date column to minimal export, only update fields of task state when it has not been created before Signed-off-by: Aaron Chong <[email protected]> * Use create and get_or_none, and save model if it exists Signed-off-by: Aaron Chong <[email protected]> --------- Signed-off-by: Aaron Chong <[email protected]> (cherry picked from commit a1ea778) Signed-off-by: Aaron Chong <[email protected]> * Feature/task initiator (#692) * Add initiator column in taskstate model Signed-off-by: fierro <[email protected]> * Initiator field has been added on client side Signed-off-by: fierro <[email protected]> * Set initiator field with the previous value if its is updated or use self.user.username if its is created Signed-off-by: fierro <[email protected]> * Add initiator as column in datagrid and show it in TaskSection Signed-off-by: fierro <[email protected]> * Populate initiator field with self.user.name when task is created Signed-off-by: fierro <[email protected]> * Add initiator column to minimal export Signed-off-by: fierro <[email protected]> * Set initiator column to minimal export Signed-off-by: fierro <[email protected]> * In update method, fill the initiator field with the previous db_task_state value Signed-off-by: fierro <[email protected]> --------- Signed-off-by: fierro <[email protected]> (cherry picked from commit 86700da) Signed-off-by: Aaron Chong <[email protected]> * Adding user and request time to requests before submitting Signed-off-by: Aaron Chong <[email protected]> * api-server, use requester instead of initiator for task_request and task_state Signed-off-by: Aaron Chong <[email protected]> * Initiator to Requester Signed-off-by: Aaron Chong <[email protected]> * Update api-client Signed-off-by: Aaron Chong <[email protected]> * Using N/A instead of unknown for fields Signed-off-by: Aaron Chong <[email protected]> * pylint Signed-off-by: Aaron Chong <[email protected]> * Changing N/A to unknown Signed-off-by: Aaron Chong <[email protected]> * Adding try catch for username promise Signed-off-by: Aaron Chong <[email protected]> --------- Signed-off-by: fierro <[email protected]> Signed-off-by: Aaron Chong <[email protected]> Co-authored-by: César Rolón <[email protected]>
What's new
Date column has been added in taskstate
This field is saved when the user creates a new task. It allows us to know when a task was created.
This field cannot be updated by the user.
Self-checks
Discussion