Comment 1 for bug 2066981

Revision history for this message
Mike Rylander (mrylander) wrote :

Branch available at: https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/miker/lp-2066981-QI-vs-reporting-data

From the commit message:

    LP#2066981: Queued Ingest vs reporter data

    Queued Ingest needs to call the function behind the non-QI simple report
    data trigger. This commit updates the core QI function to make sure
    that happens.

    In order to address any outstanding records, either refresh the reporter
    data by calling the existing database function for that purpose:

      SELECT reporter.refresh_materialized_simple_record();

    or generate a script to directly process records that have been through
    QI, similar to the following psql script:

    \t
    \o /tmp/update_reporter_data.sql

    WITH last_update AS (
        SELECT record, max(ingest_time)
          FROM action.ingest_queue_entry
          WHERE fail_time IS NULL
                AND override_by IS NULL
                AND record_type = 'biblio'
          GROUP BY 1
    ), last_action AS (
        SELECT qi.record, qi.action
          FROM action.ingest_queue_entry qi,
                last_update
          WHERE qi.record = last_update.record
                AND qi.record_type = 'biblio'
                AND qi.ingest_time = last_update.max
    ) SELECT DISTINCT 'select reporter.simple_rec_update('||record||', $$delete$$=$$'||action||'$$)'
        FROM last_action
        ORDER BY 1;

    \t
    \o
    \i /tmp/update_reporter_data.sql