Skip to content

UIEUS-493: Add reportReleases to MCL#609

Merged
elsenhans merged 3 commits into
masterfrom
UIEUS-493-add-reportRelease-to-MCL
Feb 23, 2026
Merged

UIEUS-493: Add reportReleases to MCL#609
elsenhans merged 3 commits into
masterfrom
UIEUS-493-add-reportRelease-to-MCL

Conversation

@elsenhans
Copy link
Copy Markdown
Contributor

@elsenhans elsenhans commented Feb 23, 2026

https://folio-org.atlassian.net/browse/UIEUS-493

Add "Report releases" to MultiColumnList in SASQ.

As a user, I would like to have an additional column Report releases in the provider list so that I can see which report releases of Counter reports are available within a UDP record right in the list.

The available report releases should be listed in the table cell, sorted by version number. When I want to sort the column, the entire contents of the table cell are sorted.

Use Case

Users create multiple UDPs for providers in order to have a record for each Counter release. When users search for a provider in the provider list, they want to be able to see within the provider list which report releases are available within the UDP record in addition of using the filter.

Concept

eUsage > Provider list

Adding an additional column Report releases.

  • If there are no Counter reports available for the UDP: A minus sign should be displayed. "-"
  • Counter reports are available for the UDP: The available report releases should be listed in the table cell, sorted by the version number. Each number appears only once. Example: "5, 5.1"

Acceptance criterias (UAT)

  • The new column “Report releases” is available in the provider list.
  • The report releases of the Counter reports are visible in the column "Report releases" next to the corresponding UDP data record. If there are no Counter reports a minus sign is displayed.
  • The available report releases are sorted by version number and each version number appears only once.
  • The available report releases are displayed as one string.
  • The column can be sorted alphabetically (ascending and descending).

@elsenhans elsenhans requested a review from a team as a code owner February 23, 2026 09:53
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 23, 2026

Jest Unit Test Results

193 tests  ±0   193 ✅ ±0   2m 44s ⏱️ -1s
 39 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit b62a8fb. ± Comparison against base commit 293670f.

♻️ This comment has been updated with latest results.

Copy link
Copy Markdown
Contributor

@alb3rtino alb3rtino left a comment

Choose a reason for hiding this comment

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

From the test fixtures, sorting appears to depend on reportReleases being pre-sorted. I opened https://folio-org.atlassian.net/browse/MODEUS-219 to make sure it is.

@alb3rtino
Copy link
Copy Markdown
Contributor

Consider adding reportReleases to the makeQueryFunction in UDPsRoute.js for completeness.

@alb3rtino
Copy link
Copy Markdown
Contributor

alb3rtino commented Feb 23, 2026

'columns of MCL should be present' could assert for the added 'Report releases' column header.

@sonarqubecloud
Copy link
Copy Markdown

@elsenhans elsenhans merged commit b093743 into master Feb 23, 2026
25 checks passed
@elsenhans elsenhans deleted the UIEUS-493-add-reportRelease-to-MCL branch February 23, 2026 12:26
alb3rtino added a commit to folio-org/mod-erm-usage that referenced this pull request Mar 11, 2026
…ng (#214)

https://folio-org.atlassian.net/browse/MODEUS-219

## Purpose

The `udp_report_releases` SQL function returns the `reportReleases`
array in unspecified order. The function uses `jsonb_agg(DISTINCT ...)`
with an `ORDER BY` clause at the query level, but since the query
returns a single aggregated row, the `ORDER BY` has no effect on the
array element ordering.

The PostgreSQL documentation states:

> The aggregate functions array_agg, json_agg, jsonb_agg, [...] produce
meaningfully different result values depending on the order of the input
values. This ordering is unspecified by default, but can be controlled
by writing an ORDER BY clause within the aggregate call.

The [documentation on aggregate
expressions](https://www.postgresql.org/docs/current/sql-expressions.html#SYNTAX-AGGREGATES)
further clarifies that `DISTINCT` alone does not guarantee ordering - it
only ensures each distinct value is processed once. To control ordering,
an `ORDER BY` clause must be placed within the aggregate call itself:

```sql
aggregate_name (DISTINCT expression [ , ... ] [ order_by_clause ] )
```

The existing tests in `SQLTriggersIT` assert sorted order and currently
pass, but only by coincidence - PostgreSQL's `DISTINCT` implementation
happens to use sort-based deduplication, which is not a documented
guarantee.

## Approach

Refactor `udp_report_releases` to use a subquery pattern, matching the
approach already used by `udp_report_types` and `udp_report_errors` in
the same file. This moves `DISTINCT` and `ORDER BY` into a subquery so
that sorting occurs before aggregation, making the ordering explicit and
reliable.

An alternative would be to use the inline `ORDER BY` within the
aggregate call:

```sql
SELECT COALESCE(jsonb_agg(DISTINCT jsonb->>'release' ORDER BY jsonb->>'release'), '[]'::jsonb)
```

The subquery approach was chosen for consistency with the other
functions in the same file.

## Related

folio-org/ui-erm-usage#609
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