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

[backend] Account for all relevant pauses in inject start date computation (#2282) #2319

Merged
merged 2 commits into from
Jan 31, 2025

Conversation

antoinemzs
Copy link
Contributor

@antoinemzs antoinemzs commented Jan 29, 2025

Proposed changes

  • Correctly account for pause times in inject start date computation

Related issues

Checklist

  • I consider the submitted work as finished
  • I tested the code for its functionality
  • I wrote test cases for the relevant uses case
  • I added/update the relevant documentation (either on github or on notion)
  • Where necessary I refactored code to improve the overall quality
  • For bug fix -> I implemented a test that covers the bug

Further comments

Tests are better implemented with composers hence I propose this PR to release branch. Another PR with just the code fix is going to master.

There's a drive-by fix on the schema because current pause was being persisted assuming the provided instant was local time, when in reality it was provided as UTC => the backend would compute an incorrect UTC time to persist. It was low impact but needed to be addressed.

@antoinemzs antoinemzs force-pushed the fix/armasuisse_pause_bug branch from 5444f43 to 7e8a1c8 Compare January 29, 2025 11:10
@antoinemzs antoinemzs changed the base branch from master to release/current January 29, 2025 11:10
@antoinemzs antoinemzs changed the title [backend] Account for all relevant pauses in inject start date computation [backend] Account for all relevant pauses in inject start date computation (#2282) Jan 29, 2025
Copy link

codecov bot commented Jan 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 38.08%. Comparing base (2225673) to head (0ce24c3).
Report is 3 commits behind head on release/current.

Additional details and impacted files
@@                  Coverage Diff                  @@
##             release/current    #2319      +/-   ##
=====================================================
+ Coverage              37.93%   38.08%   +0.15%     
- Complexity              1778     1782       +4     
=====================================================
  Files                    596      596              
  Lines                  18274    18274              
  Branches                1214     1214              
=====================================================
+ Hits                    6932     6960      +28     
+ Misses                 10984    10956      -28     
  Partials                 358      358              

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

Comment on lines 17 to 23
statement.execute(
"""
ALTER TABLE exercises ADD COLUMN exercise_pause_date_tempwithtz TIMESTAMP WITH TIME ZONE;
UPDATE exercises SET exercise_pause_date_tempwithtz = exercise_pause_date;
ALTER TABLE exercises DROP COLUMN exercise_pause_date;
ALTER TABLE exercises RENAME COLUMN exercise_pause_date_tempwithtz TO exercise_pause_date;
""");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There's no migration of existing data (i.e. recompute of timestamps) because I lack information on the relevant timezone that originated the Instant.
But it's not really important as it only affects currently paused simulations and would not impact them further. Assumed TZ after migration is UTC.

@antoinemzs antoinemzs force-pushed the fix/armasuisse_pause_bug branch from ea06e84 to 77f3544 Compare January 31, 2025 09:26
Signed-off-by: Antoine MAZEAS <[email protected]>
Signed-off-by: Antoine MAZEAS <[email protected]>
@antoinemzs antoinemzs force-pushed the fix/armasuisse_pause_bug branch from 77f3544 to 0ce24c3 Compare January 31, 2025 13:17
@antoinemzs antoinemzs merged commit 2b9ace7 into release/current Jan 31, 2025
6 checks passed
@antoinemzs antoinemzs deleted the fix/armasuisse_pause_bug branch January 31, 2025 13:57
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.

The first inject after a pause in a simulation doesn't get executed
2 participants