tango-app-api-trax 3.9.56 → 3.9.57

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-trax",
3
- "version": "3.9.56",
3
+ "version": "3.9.57",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -2834,6 +2834,14 @@ export async function countUpdateRunAI( req, res ) {
2834
2834
  const scores = ( question.userAnswer || [] ).map( ( ua ) => ua.complianceScore ?? 0 );
2835
2835
  score = scores.length ? Math.max( ...scores ) : 0;
2836
2836
  }
2837
+ // Single-choice questions answered 'NA' / 'N/A' (case-insensitive) contribute 0;
2838
+ // don't count the selected answer's compliance score for that question.
2839
+ if ( question.answerType === 'multiplechoicesingle' ) {
2840
+ const naAnswer = ( question.userAnswer?.[0]?.answer || '' ).toString().trim().toLowerCase();
2841
+ if ( naAnswer === 'na' || naAnswer === 'n/a' ) {
2842
+ score = 0;
2843
+ }
2844
+ }
2837
2845
  userComplianceTotal += score;
2838
2846
  }
2839
2847
  } );
@@ -2150,6 +2150,14 @@ export async function sopMobilechecklistMultiSectionFormatterv2( req, res, next
2150
2150
  if ( question.compliance ) {
2151
2151
  const scores = ( question.userAnswer || [] ).map( ( ua ) => ua?.complianceScore ?? 0 );
2152
2152
  let score = scores.length ? Math.max( ...scores ) : 0;
2153
+ // Single-choice questions answered 'NA' / 'N/A' (case-insensitive) contribute 0;
2154
+ // don't count the selected answer's compliance score for that question.
2155
+ if ( question.answerType === 'multiplechoicesingle' ) {
2156
+ const naAnswer = ( question.userAnswer?.[0]?.answer || '' ).toString().trim().toLowerCase();
2157
+ if ( naAnswer === 'na' || naAnswer === 'n/a' ) {
2158
+ score = 0;
2159
+ }
2160
+ }
2153
2161
  requestData.userComplianceCount += score;
2154
2162
  }
2155
2163
  }