Frontmatter
| id | 9037 |
| title | Refactor: Dynamic Year Fields in Contributor Model |
| state | Closed |
| labels | airefactoring |
| assignees | tobiu |
| createdAt | Feb 7, 2026, 8:58 PM |
| updatedAt | Feb 7, 2026, 9:03 PM |
| githubUrl | https://github.com/neomjs/neo/issues/9037 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | 8930 |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Feb 7, 2026, 9:03 PM |
Refactor: Dynamic Year Fields in Contributor Model
tobiu added parent issue #8930 on Feb 7, 2026, 8:58 PM

tobiu
Feb 7, 2026, 9:02 PM
Input from Gemini 3 Pro:
✦ Refactored
Contributormodel to generate year fields dynamically.
- Removed hardcoded year fields from
static config.fields.- Added
addYearFields()method called inconstruct()to generate fields from the current year down to 2010.- Added proper JSDoc comments.
Changes pushed to
dev.
tobiu assigned to @tobiu on Feb 7, 2026, 9:02 PM
tobiu closed this issue on Feb 7, 2026, 9:03 PM
Refactor
apps/devrank/model/Contributor.mjsto dynamically generate year fields (current year down to 2010) instead of using a hardcoded list.This approach:
GridContainer.mjs.Implementation Details:
static config.fields.onConstructedor a dedicated method called during class setup/init, thoughNeo.data.Modelfields are usually static. For Models, we might need to stick to static definition or use astaticblock / IIFE to generate the array before assignment if we want it to be truly dynamic at load time).Neo.data.Modelprocesses fields inprocessFields. We can assign the fields array dynamically in the class definition itself using standard JS execution.Example:
const fields = [...staticFields]; const currentYear = new Date().getFullYear(); for (let i = currentYear; i >= 2010; i--) { fields.push({name: `y${i}`, mapping: `years.${i}`, type: 'Integer'}); } // assign fields to config