c2-clinical 1.0.150 → 1.0.151

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.
@@ -9,6 +9,11 @@ declare class OnAnswerQuestionsFlowTester {
9
9
  bank: IFormUnit[];
10
10
  lines: IRow[];
11
11
  };
12
+ executeByModal(answered: IFormUnit | IRow[], modalLines: IRow[], allLines: IRow[], metActivitiesPatient?: IMetActivityPatient[]): {
13
+ bank: IFormUnit[];
14
+ allLines: IRow[];
15
+ modalLines: IRow[];
16
+ };
12
17
  }
13
18
  declare const _default: OnAnswerQuestionsFlowTester;
14
19
  export default _default;
@@ -34,5 +34,38 @@ class OnAnswerQuestionsFlowTester {
34
34
  lines: GroupFormUnitsFlow_1.default.execute(bankAnswer)
35
35
  };
36
36
  }
37
+ executeByModal(answered, modalLines, allLines, metActivitiesPatient) {
38
+ let allQuestions = ConvertRowToFormUnitsFlowItem_1.default.execute(allLines);
39
+ let modalQuestions = ConvertRowToFormUnitsFlowItem_1.default.execute(modalLines);
40
+ allQuestions.forEach((q) => {
41
+ const mq = modalQuestions.find((m) => m._id.toString() === q._id.toString());
42
+ if (mq) {
43
+ q.answer = mq.answer;
44
+ }
45
+ });
46
+ if (Array.isArray(answered)) {
47
+ const answersConverted = ConvertRowToFormUnitsFlowItem_1.default.execute(answered);
48
+ answersConverted.forEach((answer) => {
49
+ const ret = this.execute(answer, allQuestions, metActivitiesPatient);
50
+ allQuestions = ret.bank;
51
+ });
52
+ }
53
+ else {
54
+ const ret = this.execute(answered, allQuestions, metActivitiesPatient);
55
+ allQuestions = ret.bank;
56
+ }
57
+ const modalQuestionsUpdateds = [];
58
+ modalQuestions.forEach((mq) => {
59
+ const updatedQuestion = allQuestions.find((aq) => aq._id.toString() === mq._id.toString());
60
+ if (updatedQuestion) {
61
+ modalQuestionsUpdateds.push(updatedQuestion);
62
+ }
63
+ });
64
+ return {
65
+ bank: allQuestions,
66
+ allLines: GroupFormUnitsFlow_1.default.execute(allQuestions),
67
+ modalLines: GroupFormUnitsFlow_1.default.execute(modalQuestionsUpdateds)
68
+ };
69
+ }
37
70
  }
38
71
  exports.default = new OnAnswerQuestionsFlowTester();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c2-clinical",
3
- "version": "1.0.150",
3
+ "version": "1.0.151",
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>",