tango-app-api-trax 3.7.12-qid-2 → 3.7.12-qid-3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -983,7 +983,9 @@ export const update = async ( req, res ) => {
|
|
|
983
983
|
// } );
|
|
984
984
|
|
|
985
985
|
// Find max uniqueqno (cast to number, ignore null/undefined)
|
|
986
|
-
let maxQID;
|
|
986
|
+
let maxQID = 0;
|
|
987
|
+
// console.log( 'section.sectionNumber =>', section.sectionNumber );
|
|
988
|
+
// console.log( 'maxQID =>', maxQID );
|
|
987
989
|
if ( section.questions && section.questions.length > 0 ) {
|
|
988
990
|
// let qids = section.questions
|
|
989
991
|
// .filter( ( q ) => q.uniqueqno != null )
|
|
@@ -991,11 +993,14 @@ export const update = async ( req, res ) => {
|
|
|
991
993
|
// console.log( 'Extracted QIDs =>', qids );
|
|
992
994
|
// let maxQID = Math.max( 0, ...qids );
|
|
993
995
|
// console.log( 'maxQID =>', maxQID );
|
|
996
|
+
|
|
994
997
|
if ( section.maxQuestionNumber > 0 ) {
|
|
995
998
|
maxQID = section.maxQuestionNumber || 0;
|
|
996
|
-
} else {
|
|
997
|
-
maxQID = section.questions.length || 0;
|
|
998
999
|
}
|
|
1000
|
+
|
|
1001
|
+
// else {
|
|
1002
|
+
// maxQID = 0;
|
|
1003
|
+
// }
|
|
999
1004
|
for ( let [ index1, questions ] of section.questions.entries() ) {
|
|
1000
1005
|
if ( questions?.uniqueqno == null || questions.uniqueqno === 0 ) {
|
|
1001
1006
|
maxQID++;
|