Skip to content
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

Update schedule with timezone information #902

Merged
merged 3 commits into from
Feb 20, 2024

Conversation

aaronchongth
Copy link
Member

What's new

Similar to #896, but for schedule editing

  • Convert schedule update exempted date to server timezone before appending to except
  • make dashboard edit except date have time zone information
  • tests

Self-checks

  • I have prototyped this new feature (if necessary) on Figma
  • I'm familiar with and follow this Typescript guideline
  • I added unit-tests for new components
  • I tried testing edge cases
  • I tested the behavior of the components that interact with the backend, with an e2e test

…ding to except, tests, make dashboard edit except date have time zone information

Signed-off-by: Aaron Chong <[email protected]>
Copy link

codecov bot commented Feb 17, 2024

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Comparison is base (fe0e808) 49.35% compared to head (66db893) 46.43%.
Report is 63 commits behind head on deploy/hammer.

Files Patch % Lines
...s/dashboard/src/components/tasks/task-schedule.tsx 0.00% 4 Missing ⚠️
...-server/api_server/routes/tasks/scheduled_tasks.py 93.33% 2 Missing ⚠️
Additional details and impacted files
@@                Coverage Diff                @@
##           deploy/hammer     #902      +/-   ##
=================================================
- Coverage          49.35%   46.43%   -2.93%     
=================================================
  Files                285      204      -81     
  Lines               7564     6319    -1245     
  Branches            1050      820     -230     
=================================================
- Hits                3733     2934     -799     
+ Misses              3682     3379     -303     
+ Partials             149        6     -143     
Flag Coverage Δ
api-server 76.08% <93.33%> (-4.72%) ⬇️
dashboard 13.76% <0.00%> (-1.30%) ⬇️
react-components ?
rmf-auth ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -1,3 +1,4 @@
# pylint: disable=too-many-lines
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't disable the linter without a valid reason. I think the line count is probably due to duplicated code, see if it is possible to refactor them. If that is still an issue, then disable the rule globally (might want to do it regardless, imo this rule is not useful at all).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, but this is only for testing though. We could refactor it and re-used code between tests, but I was trying to prevent any stack tracing, even if the checks are repeated over tests, it doesn't make much sense to have the errors on the same lines across tests.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is really up for debate whether code duplication is justified to make test more clear. I don't really have any strong opinions, if you think that it is ok, then just disable the lint globally. imo that is not a useful rule anyway, regardless of the reasons.

@@ -234,7 +239,8 @@ async def update_schedule_task(

async with tortoise.transactions.in_transaction():
if except_date:
event_date_str = except_date.isoformat()
event_date_str = convert_date_server_timezone_iso_str(except_date)
logger.info(f"Updating event with iso format date: {event_date_str}")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Include the subject (task id).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching that, that'll be useful. I've also added more logs in the route function
66db893

We can move logs to debug during the next phase of the project when these features stabilize

@aaronchongth
Copy link
Member Author

Overall the update route is better off refactored into 2 routes, one for updating an entire schedule, the other for updating just an event. I've noted it down as a next step in our project, but for now this PR is a required fix without breaking API

@aaronchongth aaronchongth merged commit 2cd93e8 into deploy/hammer Feb 20, 2024
3 checks passed
@aaronchongth aaronchongth deleted the hammer/fix-edit-schedule-except branch February 20, 2024 05:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants