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

MODAUD-180 Modify SQL query for /status-change-history to return records if claimingInterval changed #159

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mrussakova
Copy link

@mrussakova mrussakova commented Jan 25, 2024

MODAUD-180
Modify SQL query for /status-change-history to return records if claimingInterval changed

Approach

  • SQL query updated to return all records for Delay/Send Claim if claimingInterval was changed.
  • I went ahead and removed records counting from SQL, cause it can be done by counting rows in result set

why it is draft: I haven't test it in Vagrant yet, cause had some issues with local deployment

i verified sql in this env and it looks good to me https://folio-dev-thunderjet-pgadmin.ci.folio.org/browser/
2024-01-25_19h03_48

WITH StatusChanges AS (
      SELECT id, action, piece_id, user_id, event_date, action_date, modified_content_snapshot,
         LAG(modified_content_snapshot ->> 'receivingStatus') OVER w AS previous_status,
         LAG(modified_content_snapshot ->> 'claimingInterval') OVER w AS previous_claiming_interval
      FROM consortium_mod_audit.acquisition_piece_log
      WHERE piece_id='0b6abdb3-c2fb-4f28-9735-50e484b65f65'
      WINDOW w AS (PARTITION BY piece_id ORDER BY action_date)
    )
    SELECT id, action, piece_id, user_id, event_date, action_date, modified_content_snapshot
    FROM StatusChanges 
    WHERE modified_content_snapshot ->> 'receivingStatus' IS DISTINCT FROM previous_status
       OR modified_content_snapshot ->> 'claimingInterval' IS DISTINCT FROM previous_claiming_interval

@CLAassistant
Copy link

CLAassistant commented Jan 25, 2024

CLA assistant check
All committers have signed the CLA.

@mrussakova mrussakova force-pushed the MODAUD-180_Modify_SQL_Query branch from ff88936 to 247ffe2 Compare January 25, 2024 12:58
Copy link

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