c2-clinical 1.0.122 → 1.0.123

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.
@@ -18,7 +18,9 @@ class OnAnswerQuestionsFlowTester {
18
18
  }
19
19
  executeByRows(answered, lines, metActivitiesPatient) {
20
20
  const bankAnswer = ConvertRowToFormUnitsFlowItem_1.default.execute(lines);
21
+ console.log("bankAnswerConverted", bankAnswer);
21
22
  const { bank } = this.execute(answered, bankAnswer, metActivitiesPatient);
23
+ console.log("bankAnswerReturned", bankAnswer);
22
24
  return {
23
25
  bank,
24
26
  lines: GroupFormUnitsFlow_1.default.execute(bank, [])
@@ -12,11 +12,17 @@ class ProcessAnswerFlowTester {
12
12
  const allQuestionsAnswereds = bankAnswer?.filter((q) => q.answer !== "" && q.answer !== undefined);
13
13
  answerRelacioneds.forEach((relationed) => {
14
14
  //executa fórmula para answer
15
- const answerCalculated = ExecFormulaFlowTester_1.default.execute(relationed.formulaToAnswer, allQuestionsAnswereds, attendanceMetActivities);
16
- if (relationed.answer !== answerCalculated) {
17
- relationed.answer = answerCalculated;
18
- allQuestionsAnswereds.push(relationed);
19
- autoAnswereds.push(relationed);
15
+ if (relationed.code !== questionAnswered.code) {
16
+ const answerCalculated = ExecFormulaFlowTester_1.default.execute(relationed.formulaToAnswer, allQuestionsAnswereds, attendanceMetActivities);
17
+ if (relationed.answer !== answerCalculated) {
18
+ relationed.answer = answerCalculated;
19
+ allQuestionsAnswereds.push(relationed);
20
+ autoAnswereds.push(relationed);
21
+ }
22
+ }
23
+ // formulaToDescription
24
+ if (relationed.formulaToDescription) {
25
+ relationed.description = ExecFormulaFlowTester_1.default.execute(relationed.formulaToDescription, allQuestionsAnswereds, attendanceMetActivities);
20
26
  }
21
27
  // formulaToReferenceValue
22
28
  if (relationed?.formulaToReferenceValue) {
@@ -9,6 +9,7 @@ class GetAnswerRelationedsFlowItemTester {
9
9
  regex.test(fu.formulaToClassificationLabel) ||
10
10
  regex.test(fu.formulaToClassificationColor) ||
11
11
  regex.test(fu.formulaToEnable) ||
12
+ regex.test(fu.formulaToDescription) ||
12
13
  fu.validations?.some((v) => regex.test(v.formulaToMessage)) ||
13
14
  fu.options?.some((v) => regex.test(v.formulaToEnable)));
14
15
  });
@@ -50,6 +50,7 @@ export interface IFormUnit extends IDefault {
50
50
  sequence: number;
51
51
  code: string;
52
52
  description: string;
53
+ formulaToDescription: string;
53
54
  example: string;
54
55
  parent: Types.ObjectId | IFormUnit;
55
56
  line: number;
@@ -302,6 +303,7 @@ export declare const FormUnitSchema: Schema<any, import("mongoose").Model<any, a
302
303
  account?: Types.ObjectId | null | undefined;
303
304
  description?: string | null | undefined;
304
305
  reference?: Types.ObjectId | null | undefined;
306
+ formulaToDescription?: string | null | undefined;
305
307
  example?: string | null | undefined;
306
308
  parent?: Types.ObjectId | null | undefined;
307
309
  line?: number | null | undefined;
@@ -452,6 +454,7 @@ export declare const FormUnitSchema: Schema<any, import("mongoose").Model<any, a
452
454
  account?: Types.ObjectId | null | undefined;
453
455
  description?: string | null | undefined;
454
456
  reference?: Types.ObjectId | null | undefined;
457
+ formulaToDescription?: string | null | undefined;
455
458
  example?: string | null | undefined;
456
459
  parent?: Types.ObjectId | null | undefined;
457
460
  line?: number | null | undefined;
@@ -602,6 +605,7 @@ export declare const FormUnitSchema: Schema<any, import("mongoose").Model<any, a
602
605
  account?: Types.ObjectId | null | undefined;
603
606
  description?: string | null | undefined;
604
607
  reference?: Types.ObjectId | null | undefined;
608
+ formulaToDescription?: string | null | undefined;
605
609
  example?: string | null | undefined;
606
610
  parent?: Types.ObjectId | null | undefined;
607
611
  line?: number | null | undefined;
@@ -37,6 +37,7 @@ exports.FormUnitSchema = new mongoose_1.Schema({
37
37
  form: { type: mongoose_1.Schema.Types.ObjectId, ref: "form", required: true },
38
38
  sequence: { type: Number, required: true },
39
39
  code: { type: String, required: true },
40
+ formulaToDescription: { type: String },
40
41
  description: { type: String },
41
42
  example: { type: String },
42
43
  parent: { type: mongoose_1.Schema.Types.ObjectId, ref: "form-unit" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-clinical",
3
- "version": "1.0.122",
3
+ "version": "1.0.123",
4
4
  "description": "Biblioteca Typescript para API NodeJS",
5
5
  "repository": "https://github.com/cabralsilva/c2-clinical.git",
6
6
  "author": "Daniel Cabral <cabralconsultoriaemsoftware@gmail.com>",