Skip to content

fix(tags): list planning tags in Danish alphabetical order (#2126) - #2127

Merged
renemadsen merged 2 commits into
stablefrom
fix/2126-tags-danish-order
Sep 27, 2026
Merged

renemadsen merged 2 commits into
stablefrom
fix/2126-tags-danish-order

Conversation

@renemadsen

Copy link
Copy Markdown
Member

Closes #2126

What

GET …/items-planning-pn/tags (ItemsPlanningTagsService.GetItemsPlanningTags) sorted in SQL, so the order came from the column collation (utf8mb4_general_ci), which folds Å to A. The tags are now loaded and then sorted in memory with a new shared TagNameComparer.Danish (StringComparer.Create(CultureInfo.GetCultureInfo("da-DK"), ignoreCase: true)). The order is always da-DK, whatever the user's UI language, which gives a…z, æ, ø, å. This is the same rule microting/eform-backendconfiguration-plugin#1334 uses for task tags (TagNameComparer.Danish, PR #1343 there). Every picker built on this endpoint, including backend-configuration's "Redigér etiketter", the tag filters and the task wizard, gets the new order.

Note: da-DK collation sorts "aa" as "å", so a tag that starts with "Aa" is listed after Ø. This is intended.

Audit of other tag endpoints

  • Changed: ItemsPlanningTagsService.GetItemsPlanningTags. It was the only place in the plugin that sorted tag names (OrderBy(x => x.Name) on PlanningTags).

  • Left as is: these return tag names but do not sort them:

    • PlanningService: the planning list/read Tags projection.
    • ItemsPlanningReportService: NameTagsInEndPage.
    • PlanningImportService and PairingService look tags up by name or id only.

    Adding an order to these would be a separate change.

Tests

  • New NUnit integration test eFormAPI/Plugins/ItemsPlanning.Pn/ItemsPlanning.Pn.Test/ItemsPlanningTagsServiceOrderTests.cs. It starts a real MariaDB through Testcontainers (the package was already referenced) and builds the schema with EnsureCreated. It creates tags in the order Øko, Beta, Åben, Alfa, Æble and asserts the result is Alfa, Beta, Æble, Øko, Åben. Because the database is real, the test also fails if the sort moves back into SQL.
  • It runs in CI in the test-dotnet job of .github/workflows/dotnet-core-pr.yml (dotnet test -c Release … ItemsPlanning.Pn.Test.csproj on ubuntu-latest, where Docker is available).
  • Verified locally: dotnet build of the solution and of the test project in Release. No tests were run locally; they run in CI only.

🤖 Generated with Claude Code

https://claude.ai/code/session_017kbiaVNigNkVARtq94xkDa

GetItemsPlanningTags sorted in SQL, so the order came from the column
collation (utf8mb4_general_ci), which folds Å to A. Materialise the tags
and sort them in memory with TagNameComparer.Danish (da-DK,
case-insensitive, always Danish regardless of UI language), the same rule
backend-configuration uses for task tags.

Adds a Testcontainers MariaDB integration test: tags created as Øko, Beta,
Åben, Alfa, Æble come back as Alfa, Beta, Æble, Øko, Åben.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017kbiaVNigNkVARtq94xkDa
Copilot AI lite review requested due to automatic review settings September 27, 2026 07:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

No unresolved issues were identified that would block approval.

Review effort: Lite
Findings: None

What changed in this PR

Updates planning tag retrieval to use deterministic Danish alphabetical ordering.

Changes:

  • Moves sorting from SQL to in-memory Danish collation.
  • Adds a reusable Danish tag comparer.
  • Adds MariaDB-backed integration coverage.
File Description
eFormAPI/​Plugins/​ItemsPlanning.Pn/​ItemsPlanning.Pn/​Services/​ItemsPlanningTagsService/​ItemsPlanningTagsService.cs Updated as part of this pull request.
eFormAPI/​Plugins/​ItemsPlanning.Pn/​ItemsPlanning.Pn/​Helpers/​TagNameComparer.cs Updated as part of this pull request.
eFormAPI/​Plugins/​ItemsPlanning.Pn/​ItemsPlanning.Pn.Test/​ItemsPlanningTagsServiceOrderTests.cs Updated as part of this pull request.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI review requested due to automatic review settings September 27, 2026 09:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

No unresolved issues were identified that would block approval.

Review effort: Lite
Findings: None

@renemadsen

Copy link
Copy Markdown
Member Author

Copilot review considered: it recommends approval, with no findings. With stable merged in (the shard-a fix #2129), every check is green, including shard a and test-dotnet, which runs the new da-DK tag-order test. The exception is Codacy's account-side action_required, which reports 0 issues and is exempted by the maintainer.

@renemadsen
renemadsen merged commit 04c6705 into stable Sep 27, 2026
8 of 9 checks passed
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