Skip to content

Fix array fields dropping entries beyond the 9th on factsheet submit#2365

Open
ajith1994 wants to merge 3 commits into
OpenEnergyPlatform:developfrom
ajith1994:fix-2328-model-factsheet-authors-dropped
Open

Fix array fields dropping entries beyond the 9th on factsheet submit#2365
ajith1994 wants to merge 3 commits into
OpenEnergyPlatform:developfrom
ajith1994:fix-2328-model-factsheet-authors-dropped

Conversation

@ajith1994

@ajith1994 ajith1994 commented Jul 3, 2026

Copy link
Copy Markdown

Summary of the discussion

Issue #2328: adding more than 9 entries to an array field on a Model/Framework
factsheet (e.g. Author(s)) causes everything from the 10th entry onward to be
silently dropped on submit, and not restored when re-editing.

Root cause is in processPost() (modelview/helper.py): the regex
^{field}_\d$ matches only a single trailing digit, so field names like
authors_10, authors_11 never match and are discarded before saving.
parts.sort() also did a lexicographic (string) sort rather than numeric,
which would have scrambled entry order once the truncation was fixed.

Fix: changed \d$ to \d+$, and sort parts numerically by the trailing
index instead of lexicographically. Manually verified by submitting a Model
factsheet with 12 authors and confirming all 12 persist, in the correct
order, in modelview_basicfactsheet.authors.

Type of change (CHANGELOG.md)

Bugs

  • Fix Model/Framework factsheets silently dropping the 10th and later
    entries of array fields (e.g. Author(s)) on submit, caused by a regex
    that only matched single-digit field-name suffixes.
    (#2365)

Workflow checklist

Automation

Closes #2328

PR-Assignee

@ajith1994

Copy link
Copy Markdown
Author

Hi @jh-RLI,

Could you take a look when you get a chance? This fixes #2328 (Model/Framework
factsheets silently dropping array field entries beyond the 9th on submit).

This is my first contribution to the project. I will be happy to make any changes you'd like to see. And, please let me know if I have missed out anything.

Thank you!

@jh-RLI

jh-RLI commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

@ajith1994 Thanks a lot for the contribution. I’ll take a closer look at it next week; at first glance, it seems like you fixed it.

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.

Model Factsheet - General: More than 9 authors are dropped

2 participants