Uploaded image for project: 'mod-orders'
  1. mod-orders
  2. MODORDERS-610

PoLine search querying non-existing poLine.acqUnitIds

    XMLWordPrintable

Details

    Description

      Purpose/Overview:

      With simple order line queries such as

      /orders/order-lines?query=paymentStatus==Open

      mod-orders will try to use poLine.acqUnitIds, which does not exist.

      This warning will be visible in mod-orders-storage:

      WARNING: Doing LIKE search without index for po_line.jsonb->>'acqUnitIds', CQL >>> SQL: acqUnitId
      {{ s <> [] >>> lower(f_unaccent(po_line.jsonb->>'acqUnitIds')) NOT LIKE lower(f_unaccent('[]'))}}

      The issue is in AcquisitionsUnitsService#buildAcqUnitsCqlExprToSearchRecords. The tableAlias argument is not used when an empty list of ids is retrieved.

      The issue was introduced in Juniper by MODORDERS-504.

      Consequences of the issue:

      • All matching order lines are returned for a query of a user who is not associated with any acquisition unit, even order lines of an order with an acquisition unit.
      • Potential slowdown of all order line queries

      Requirements/Scope:

      Fix buildAcqUnitsCqlExprToSearchRecords.

      Approach:

      Include tableAlias into NO_ACQ_UNIT_ASSIGNED_CQL.

      Acceptance criteria:

      Check that a user who is not allowed to see an order line because of acquisition units is indeed not seeing it when doing a query for po lines. Also make sure no warning is visible in mod-orders-storage after fixing.

      TestRail: Results

        Attachments

          Issue Links

            Activity

              People

                damieng Damien Guillaume
                damieng Damien Guillaume
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  TestRail: Runs

                    TestRail: Cases