@quesmed/types 1.3.7 → 1.3.8
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 +1 -1
- package/utils/commonFunctions.js +5 -2
package/package.json
CHANGED
package/utils/commonFunctions.js
CHANGED
|
@@ -84,7 +84,8 @@ function formatPrescribeAnswer(obj) {
|
|
|
84
84
|
durationMatches.add(durationWords.toString());
|
|
85
85
|
}
|
|
86
86
|
obj.duration.value = [...durationMatches].filter((x) => !!x).join(',');
|
|
87
|
-
|
|
87
|
+
const orgFrequencyValue = obj.frequency.value.toLowerCase();
|
|
88
|
+
obj.frequency.value = orgFrequencyValue.replace(/\s/g, '');
|
|
88
89
|
const frequencyIncHourly = obj.frequency.value.includes('hour');
|
|
89
90
|
const hourlyFreqInt = parseInt(obj.frequency.value);
|
|
90
91
|
if (obj.frequency.value === 'once-off') {
|
|
@@ -107,7 +108,7 @@ function formatPrescribeAnswer(obj) {
|
|
|
107
108
|
obj.frequency.value = 'qds';
|
|
108
109
|
}
|
|
109
110
|
else if (!ACCEPTED_FREQ.includes(obj.frequency.value)) {
|
|
110
|
-
obj.frequency.value = (0, wordsToNumber_1.wordsToNumber)(
|
|
111
|
+
obj.frequency.value = (0, wordsToNumber_1.wordsToNumber)(orgFrequencyValue, true).toString();
|
|
111
112
|
}
|
|
112
113
|
return obj;
|
|
113
114
|
}
|
|
@@ -172,6 +173,7 @@ function correctMark(mark) {
|
|
|
172
173
|
}
|
|
173
174
|
}
|
|
174
175
|
else if (models_1.EQuestionType.PRESCRIPTION_ANSWER === mark.question.typeId) {
|
|
176
|
+
console.log('answers');
|
|
175
177
|
const answers = answer.map(formatPrescribeAnswer);
|
|
176
178
|
let attempt = formatPrescribeAnswer(mapPrescribeMarkToAnswer({
|
|
177
179
|
drug: '',
|
|
@@ -181,6 +183,7 @@ function correctMark(mark) {
|
|
|
181
183
|
frequency: '',
|
|
182
184
|
duration: '',
|
|
183
185
|
}));
|
|
186
|
+
console.log('attempt');
|
|
184
187
|
if (typeof flatAttempt === 'object' && Object.keys(flatAttempt).length === 6) {
|
|
185
188
|
attempt = formatPrescribeAnswer(mapPrescribeMarkToAnswer(flatAttempt));
|
|
186
189
|
}
|