Skip to content

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
@sonarqubecloud
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.

3 participants