Skip to content

[Acc/Grant] Merge application form sections better #5533

@DanThrane

Description

@DanThrane

NOTE: I am bit unsure about this issue. This issue might simply require reviewing the merging logic after the rest of #5529 is done. This issue might not actually require new code and simply only require testing.


When the editor combines templates from multiple grant givers, it currently deduplicates sections by title and keeps the first description it sees. Update the merge logic so matching fields are combined by name, metadata is reconciled predictably, and unrelated fields stay in source order.

Relevant source locations:

  • frontend-web/webclient/app/Grants/Editor.tsx (calculateNewApplication, parseIntoSections)
  • provider-integration/shared/pkg/accounting/grants.go (Templates)
  • core2/pkg/accounting/grants.go (grant application model)

The merge happens in calculateNewApplication, after each template string has been parsed into ApplicationSections. That is the place to change the deduplication and ordering rules before the editor state is rebuilt.

parseIntoSections already extracts title, description, limit, and row hints from the plain-text template. Reuse those values when combining sections so later templates do not silently lose metadata.

Success criteria:

  • Sections with the same name merge into one field.
  • Identical descriptions are shown once; differing descriptions are shown together.
  • The most restrictive length and the largest row count are chosen.
  • Distinct fields stay grouped by grant giver instead of being interleaved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions