Skip to content

MAB-624: Remove non visible questions from _progress#122

Draft
Joselgc1 wants to merge 1 commit intounesco-mabfrom
MAB-624
Draft

MAB-624: Remove non visible questions from _progress#122
Joselgc1 wants to merge 1 commit intounesco-mabfrom
MAB-624

Conversation

@Joselgc1
Copy link

Description

Fixed the progress bar calculation on forms to exclude invisible questions from the percentage.

The issue was that required questions hidden by isVisibleIf were still being counted. Created a isQuestionVisible() helper function that checks both the question and its parent visibility (it was already implemented locally), and we use it on the progress filter to update the value.

Now, only visible required questions count for completion.

Useful links

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

( * == Mandatory )

  • * I have set myself as assignee of the pull request
  • * My code follows the style guidelines of this project
  • * Linting does not generate new warnings
  • * I have performed a self-review of my own code
  • * I have put the ticket for review, adding the oort-frontend team to the list of reviewers
  • * I have commented my code, particularly in hard-to-understand areas
  • * I have put JSDoc comment in all required places
  • * My changes generate no new warnings
  • * I have included screenshots describing my changes if relevant
  • * I have selected labels in the Pull Request, according to the changes with code brings
  • I have made corresponding changes to the documentation ( if required )
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@Joselgc1 Joselgc1 changed the title Remove non visible questions from _progress MAB-624: Remove non visible questions from _progress Jan 19, 2026
@AntoineRelief
Copy link
Collaborator

@Joselgc1
It looks like something else than what is described in the PR, can you check?

@AntoineRelief AntoineRelief marked this pull request as draft January 20, 2026 09:23
@Joselgc1
Copy link
Author

Joselgc1 commented Jan 20, 2026

@AntoineRelief I added this because I ran into in an error when I first tried loading the "[MAB] Fillable form":

Updating incremental ids record from resource "[MAB] Fillable form"... ({year}-{resourceInitial}{incremental} -> {year}-{resourceInitial}{incremental}) /home/joselgc/work/mab/oort-backend/node_modules/mongodb/src/bulk/common.ts:1274 new MongoBulkWriteError( ^ MongoBulkWriteError: E11000 duplicate key error collection: mab-test.records index: incrementalId_1_resource_1 dup key: { incrementalId: "2025-[00000001", resource: ObjectId('6790800dc802f229e9128bb0') } at OrderedBulkOperation.handleWriteError (/home/joselgc/work/mab/oort-backend/node_modules/mongodb/src/bulk/common.ts:1274:9) at resultHandler (/home/joselgc/work/mab/oort-backend/node_modules/mongodb/src/bulk/common.ts:586:23) at /home/joselgc/work/mab/oort-backend/node_modules/mongodb/src/utils.ts:379:15 at processTicksAndRejections (node:internal/process/task_queues:105:5) { code: 11000, writeErrors: [ WriteError { err: [Object] } ], result: BulkWriteResult { insertedCount: 0, matchedCount: 27, modifiedCount: 27, deletedCount: 0, upsertedCount: 0, upsertedIds: {}, insertedIds: {} }, [Symbol(errorLabels)]: Set(0) {} } [nodemon] app crashed - waiting for file changes before starting...

The error was caused because with the original code the first read character is "[", creating some invalid IDs, and also caused duplicated key errors when trying to update existing records. This commit prevents that error from happening so I thought you might want to see it. Don't know if implementing is needed but it solved the issue on my local machine.

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