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

[O2B-1365] Implement GAQ periods views #1808

Open
wants to merge 22 commits into
base: main
Choose a base branch
from

Conversation

xsalonx
Copy link
Collaborator

@xsalonx xsalonx commented Dec 3, 2024

I have a JIRA ticket

  • branch and/or PR name(s) include(s) JIRA ID
  • issue has "Fix version" assigned
  • issue "Status" is set to "In review"
  • PR labels are selected

Notable changes for users:

  • NA

Notable changes for developers:

  • Implement stored SQL views for selecting GAQ periods and summaries information

Changes made to the database:

  • NA

Copy link

codecov bot commented Dec 3, 2024

Codecov Report

Attention: Patch coverage is 93.33333% with 2 lines in your changes missing coverage. Please review.

Project coverage is 44.08%. Comparing base (e539a88) to head (b56bc51).

Files with missing lines Patch % Lines
...erver/services/qualityControlFlag/QcFlagService.js 91.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1808      +/-   ##
==========================================
+ Coverage   43.86%   44.08%   +0.21%     
==========================================
  Files         891      891              
  Lines       15971    15985      +14     
  Branches     3020     3032      +12     
==========================================
+ Hits         7006     7047      +41     
+ Misses       8965     8938      -27     

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

@xsalonx xsalonx changed the title [O2B-1365] Implement GAQ periods and summeries views [O2B-1365] Implement GAQ periods views Dec 3, 2024
@xsalonx xsalonx requested a review from martinboulais December 4, 2024 11:36
Comment on lines +66 to +71
NTH_VALUE(timestamp, 2) OVER (
PARTITION BY data_pass_id,
run_number
ORDER BY ap.ordering_timestamp
ROWS BETWEEN CURRENT ROW AND 1 FOLLOWING
) AS \`to\`,
Copy link
Collaborator

Choose a reason for hiding this comment

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

This kind of function are relatively rarely used (in my experience), it might be useful to put a small comment stating what you are doing here?
Also, maybe you can replace the NTH_VALUE and ROWS BETWEEN... by the LAG function? You might need to reverse the order, not sure

gaq_periods.\`from\`,
gaq_periods.\`to\`;
SELECT * FROM gaq_periods
WHERE IF(gaq_periods.\`to\` = UNIX_TIMESTAMP(NOW(3)), null, gaq_periods.\`to\`) IS NOT NULL
Copy link
Collaborator

Choose a reason for hiding this comment

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

If I am correct, you do not need the if anymore?

1,
null
),
SUM(
COALESCE(effectivePeriods.\`to\`, UNIX_TIMESTAMP(run.time_end))
- COALESCE(effectivePeriods.\`from\`, UNIX_TIMESTAMP(run.time_start))
COALESCE(gaq_periods.\`to\`, UNIX_TIMESTAMP(run.time_end))
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am not sure, but I think here what you should use is rct_time_start and rct_time_end. I created a PR here: #1816

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants