@universis/evaluations 1.0.38 → 1.0.40

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.
@@ -81,7 +81,24 @@
81
81
  "description": "Αριθμός φοιτητών που μπορούν να αξιολογήσουν",
82
82
  "type": "Integer",
83
83
  "nullable": true
84
+ },
85
+ {
86
+ "name": "statistics",
87
+ "title": "Evaluation statistics",
88
+ "type": "EvaluationStatistic",
89
+ "many": true,
90
+ "mapping": {
91
+ "parentModel": "ClassInstructorEvaluationEvent",
92
+ "childModel": "EvaluationStatistic",
93
+ "parentField": "id",
94
+ "childField": "target",
95
+ "cascade": "delete",
96
+ "associationType": "association",
97
+ "options": {
98
+ "$filter": "targetType eq 'ClassInstructorEvaluationEvent'"
99
+ }
84
100
  }
101
+ }
85
102
  ],
86
103
  "eventListeners": [
87
104
  {
@@ -0,0 +1,67 @@
1
+ {
2
+ "$schema": "https://themost-framework.github.io/themost/models/2018/2/schema.json",
3
+ "@id": "https://universis.io/entities/ClassInstructorEvaluationStatistic",
4
+ "abstract": false,
5
+ "hidden": false,
6
+ "sealed": true,
7
+ "title": "ClassInstructorEvaluationStatistic",
8
+ "name": "ClassInstructorEvaluationStatistic",
9
+ "version": "1.1",
10
+ "description": "Contains a collection of extra field regarding evaluation statistics.",
11
+ "view": "ClassInstructorEvaluationStatisticData",
12
+ "source": "EvaluationStatisticBase",
13
+ "inherits": "EvaluationStatistic",
14
+ "fields": [
15
+ {
16
+ "name": "target",
17
+ "title": "Target ID",
18
+ "description": "Identifier of the evaluated entity.",
19
+ "type": "ClassInstructorEvaluationEvent",
20
+ "nullable": false,
21
+ "editable": false
22
+ }
23
+ ],
24
+ "privileges": [
25
+ {
26
+ "mask": 15,
27
+ "type": "global"
28
+ },
29
+ {
30
+ "mask": 31,
31
+ "type": "global",
32
+ "account": "Administrators"
33
+ },
34
+ {
35
+ "mask": 17,
36
+ "type": "self",
37
+ "account": "Registrar",
38
+ "filter": "target/organizer eq departments()",
39
+ "scope": [
40
+ "qa"
41
+ ]
42
+ },
43
+ {
44
+ "mask": 17,
45
+ "type": "global",
46
+ "account": "QualityAssuranceUnit"
47
+ },
48
+ {
49
+ "mask": 17,
50
+ "type": "self",
51
+ "account": "QualityAssuranceDepartment",
52
+ "filter": "target/organizer eq departments()",
53
+ "scope": [
54
+ "qa"
55
+ ]
56
+ },
57
+ {
58
+ "mask": 17,
59
+ "type": "self",
60
+ "account": "Instructors",
61
+ "filter": "target/courseClassInstructor/courseClass/instructors/instructor eq instructor()",
62
+ "scope": [
63
+ "teachers"
64
+ ]
65
+ }
66
+ ]
67
+ }
@@ -72,7 +72,23 @@
72
72
  "description": "Αριθμός φοιτητών που μπορούν να αξιολογήσουν",
73
73
  "type": "Integer",
74
74
  "nullable": true
75
+ },
76
+ {
77
+ "name": "statistics",
78
+ "type": "EvaluationStatistic",
79
+ "many": true,
80
+ "mapping": {
81
+ "parentModel": "CourseClassEvaluationEvent",
82
+ "parentField": "id",
83
+ "childModel": "EvaluationStatistic",
84
+ "childField": "target",
85
+ "associationType": "association",
86
+ "cascade": "delete",
87
+ "options": {
88
+ "$filter": "targetType eq 'CourseClassEvaluationEvent'"
89
+ }
75
90
  }
91
+ }
76
92
  ],
77
93
  "privileges": [
78
94
  {
@@ -0,0 +1,67 @@
1
+ {
2
+ "$schema": "https://themost-framework.github.io/themost/models/2018/2/schema.json",
3
+ "@id": "https://universis.io/entities/CourseClassEvaluationStatistic",
4
+ "abstract": false,
5
+ "hidden": false,
6
+ "sealed": true,
7
+ "title": "CourseClassEvaluationStatistic",
8
+ "name": "CourseClassEvaluationStatistic",
9
+ "version": "1.1",
10
+ "description": "Contains a collection of extra field regarding evaluation statistics.",
11
+ "view": "CourseClassEvaluationStatisticData",
12
+ "source": "EvaluationStatisticBase",
13
+ "inherits": "EvaluationStatistic",
14
+ "fields": [
15
+ {
16
+ "name": "target",
17
+ "title": "Target ID",
18
+ "description": "Identifier of the evaluated entity.",
19
+ "type": "CourseClassEvaluationEvent",
20
+ "nullable": false,
21
+ "editable": false
22
+ }
23
+ ],
24
+ "privileges": [
25
+ {
26
+ "mask": 15,
27
+ "type": "global"
28
+ },
29
+ {
30
+ "mask": 31,
31
+ "type": "global",
32
+ "account": "Administrators"
33
+ },
34
+ {
35
+ "mask": 17,
36
+ "type": "self",
37
+ "account": "Registrar",
38
+ "filter": "target/organizer eq departments()",
39
+ "scope": [
40
+ "qa"
41
+ ]
42
+ },
43
+ {
44
+ "mask": 17,
45
+ "type": "global",
46
+ "account": "QualityAssuranceUnit"
47
+ },
48
+ {
49
+ "mask": 17,
50
+ "type": "self",
51
+ "account": "QualityAssuranceDepartment",
52
+ "filter": "target/courseClass/course/department eq departments()",
53
+ "scope": [
54
+ "qa"
55
+ ]
56
+ },
57
+ {
58
+ "mask": 17,
59
+ "type": "self",
60
+ "account": "Instructors",
61
+ "filter": "target/courseClass/instructors/instructor eq instructor()",
62
+ "scope": [
63
+ "teachers"
64
+ ]
65
+ }
66
+ ]
67
+ }
@@ -0,0 +1,204 @@
1
+ {
2
+ "$schema": "https://themost-framework.github.io/themost/models/2018/2/schema.json",
3
+ "@id": "https://universis.io/entities/EvaluationStatistic",
4
+ "abstract": false,
5
+ "hidden": false,
6
+ "sealed": false,
7
+ "title": "EvaluationStatistic",
8
+ "version": "1.2",
9
+ "name": "EvaluationStatistic",
10
+ "description": "Contains a collection of extra field regarding evaluation statistics.",
11
+ "fields": [
12
+ {
13
+ "@id": "https://themost.io/schemas/id",
14
+ "name": "id",
15
+ "title": "ID",
16
+ "description": "The identifier of the item.",
17
+ "type": "Counter",
18
+ "primary": true,
19
+ "nullable": false
20
+ },
21
+ {
22
+ "name": "target",
23
+ "title": "Target ID",
24
+ "description": "Identifier of the evaluated entity.",
25
+ "type": "Integer",
26
+ "nullable": false,
27
+ "editable": false
28
+ },
29
+ {
30
+ "name": "targetType",
31
+ "title": "Target Type",
32
+ "description": "Type of the evaluated entity (e.g., CourseClassEvaluationEvent, CourseClassInstructorEvaluationEvent, Instructor, Department).",
33
+ "type": "Text",
34
+ "nullable": false,
35
+ "editable": false
36
+ },
37
+
38
+ {
39
+ "name": "average",
40
+ "title": "Average Score",
41
+ "description": "Mean evaluation score.",
42
+ "type": "Number"
43
+ },
44
+ {
45
+ "name": "stdDev",
46
+ "title": "Standard Deviation",
47
+ "description": "Standard deviation of scores.",
48
+ "type": "Number"
49
+ },
50
+ {
51
+ "name": "subAverage",
52
+ "title": "Sub average value",
53
+ "description": "The average value of child indicators within the evaluation hierarchy (e.g. average of sub evaluation events average).",
54
+ "type": "Number"
55
+ },
56
+ {
57
+ "name": "subStdDev",
58
+ "title": "Sub standard deviation value",
59
+ "description": "The standard deviation value of child indicators within the evaluation hierarchy (e.g. standard deviation of sub evaluation events average).",
60
+ "type": "Number"
61
+ },
62
+ {
63
+ "name": "qualityIndex",
64
+ "title": "Quality Index",
65
+ "description": "Quality index.",
66
+ "type": "Number"
67
+ },
68
+ {
69
+ "name": "total",
70
+ "title": "Eligible Participants",
71
+ "description": "Number of uses eligible to participate.",
72
+ "type": "Integer"
73
+ },
74
+ {
75
+ "name": "totalResponses",
76
+ "many": false,
77
+ "title": "Responses",
78
+ "description": "Number of submitted evaluations.",
79
+ "type": "Integer"
80
+ },
81
+ {
82
+ "name": "results",
83
+ "many": false,
84
+ "title": "Detailed Results",
85
+ "description": "Detailed evaluation data in JSON format.",
86
+ "type": "Json"
87
+ },
88
+ {
89
+ "name": "position",
90
+ "title": "position",
91
+ "description": "Position of the evaluated entity within its category (e.g. course ranking within the department).",
92
+ "type": "Number"
93
+ },
94
+ {
95
+ "name": "ranking",
96
+ "title": "Ranking",
97
+ "description": "Ranking of the evaluated entity within its category (e.g. course ranking within the department).",
98
+ "type": "Number"
99
+ },
100
+ {
101
+ "@id": "http://schema.org/academicYear",
102
+ "name": "academicYear",
103
+ "title": "Academic year",
104
+ "type": "AcademicYear",
105
+ "nullable": false
106
+ },
107
+ {
108
+ "@id": "http://schema.org/academicPeriod",
109
+ "name": "academicPeriod",
110
+ "title": "Academic Period",
111
+ "type": "AcademicPeriod",
112
+ "nullable": false
113
+ },
114
+ {
115
+ "@id": "http://schema.org/organizer",
116
+ "name": "organizer",
117
+ "title": "organizer",
118
+ "description": "An organizer of an Event.",
119
+ "type": "Department"
120
+ },
121
+ {
122
+ "@id": "https://universis.io/metadata",
123
+ "name": "metadata",
124
+ "many": false,
125
+ "description": "A metadata object that contains additional information about the item.",
126
+ "type": "Json"
127
+ },
128
+ {
129
+ "name": "dateCreated",
130
+ "title": "Date Created",
131
+ "description": "The date on which this item was created.",
132
+ "type": "DateTime",
133
+ "value": "javascript:return (new Date());",
134
+ "readonly": true
135
+ },
136
+ {
137
+ "name": "dateModified",
138
+ "title": "Date Modified",
139
+ "description": "The date on which this item was most recently modified.",
140
+ "type": "DateTime",
141
+ "readonly": true,
142
+ "value": "javascript:return (new Date());",
143
+ "calculation": "javascript:return (new Date());"
144
+ },
145
+ {
146
+ "name": "createdBy",
147
+ "title": "Created By",
148
+ "description": "Created by user.",
149
+ "type": "Integer",
150
+ "value": "javascript:return this.user();",
151
+ "readonly": true
152
+ },
153
+ {
154
+ "name": "modifiedBy",
155
+ "title": "Modified By",
156
+ "description": "Modified by user.",
157
+ "type": "Integer",
158
+ "calculation": "javascript:return this.user();",
159
+ "readonly": true
160
+ }
161
+ ],
162
+ "constraints": [
163
+ {
164
+ "type": "unique",
165
+ "fields": [
166
+ "target",
167
+ "targetType",
168
+ "academicYear",
169
+ "academicPeriod",
170
+ "organizer"
171
+ ]
172
+ }
173
+ ],
174
+ "privileges": [
175
+ {
176
+ "mask": 31,
177
+ "type": "global"
178
+ },
179
+ {
180
+ "mask": 1,
181
+ "type": "global",
182
+ "account": "*"
183
+ },
184
+ {
185
+ "mask": 15,
186
+ "type": "global",
187
+ "account": "Administrators"
188
+ },
189
+ {
190
+ "mask": 31,
191
+ "type": "global",
192
+ "account": "QualityAssuranceUnit"
193
+ },
194
+ {
195
+ "mask": 31,
196
+ "type": "self",
197
+ "account": "QualityAssuranceDepartment",
198
+ "filter": "organizer eq departments()",
199
+ "scope": [
200
+ "qa"
201
+ ]
202
+ }
203
+ ]
204
+ }
@@ -0,0 +1,68 @@
1
+ {
2
+ "$schema": "https://themost-framework.github.io/themost/models/2018/2/schema.json",
3
+ "@id": "https://universis.io/entities/InstructorEvaluationStatistic",
4
+ "abstract": false,
5
+ "hidden": false,
6
+ "sealed": true,
7
+ "title": "InstructorEvaluationStatistic",
8
+ "name": "InstructorEvaluationStatistic",
9
+ "version": "1.1",
10
+ "description": "Contains a collection of extra field regarding evaluation statistics.",
11
+ "view": "InstructorEvaluationStatisticData",
12
+ "source": "EvaluationStatisticBase",
13
+ "inherits": "EvaluationStatistic",
14
+ "fields": [
15
+ {
16
+ "name": "target",
17
+ "title": "Target ID",
18
+ "description": "Identifier of the evaluated entity.",
19
+ "type": "Instructor",
20
+ "nullable": false,
21
+ "editable": false
22
+ }
23
+
24
+ ],
25
+ "privileges": [
26
+ {
27
+ "mask": 15,
28
+ "type": "global"
29
+ },
30
+ {
31
+ "mask": 31,
32
+ "type": "global",
33
+ "account": "Administrators"
34
+ },
35
+ {
36
+ "mask": 17,
37
+ "type": "self",
38
+ "account": "Registrar",
39
+ "filter": "organizer eq departments()",
40
+ "scope": [
41
+ "qa"
42
+ ]
43
+ },
44
+ {
45
+ "mask": 17,
46
+ "type": "global",
47
+ "account": "QualityAssuranceUnit"
48
+ },
49
+ {
50
+ "mask": 17,
51
+ "type": "self",
52
+ "account": "QualityAssuranceDepartment",
53
+ "filter": "organizer eq departments()",
54
+ "scope": [
55
+ "qa"
56
+ ]
57
+ },
58
+ {
59
+ "mask": 17,
60
+ "type": "self",
61
+ "account": "Instructors",
62
+ "filter": "instructor eq instructor()",
63
+ "scope": [
64
+ "teachers"
65
+ ]
66
+ }
67
+ ]
68
+ }
@@ -634,6 +634,17 @@ _data.EdmMapping.func('FormAttributesSummary', _data.EdmType.CollectionOf('Objec
634
634
 
635
635
 
636
636
 
637
+
638
+
639
+
640
+
641
+
642
+
643
+
644
+
645
+
646
+
647
+
637
648
 
638
649
 
639
650
 
@@ -702,25 +713,28 @@ _data.EdmMapping.action('Evaluate', 'Object'), _dec(_class = (_class2 = class Ev
702
713
  label: translations[keyValue.label] || keyValue.label };};if (key.type === 'radio') {if (attribute.isNumber) {if (summaryValues.length === 0) {// add radio values from first key
703
714
  summaryValues.push.apply(summaryValues, key.values);} else {//add values only if not exist
704
715
  summaryValues.push.apply(summaryValues, key.values.filter((x) => {return summaryValues.findIndex((y) => {return y.value === x.value;}) < 0;}));}} else {// prepare the attribute's values for post-processing (e.g. count)
705
- attribute.values = (key.values || []).map(valuesMapper);}}if (!attribute.isNumber) {if (['select', 'selectboxes'].includes(key.type)) {const values = key.data && Array.isArray(key.data.values) ? key.data.values : key.values; // prepare the attribute's values for post-processing (e.g. count)
716
+ attribute.values = (key.values || []).map(valuesMapper);}}if (!attribute.isNumber || attribute.isNumber && key.type === 'radio') {if (['select', 'selectboxes', 'radio'].includes(key.type)) {const values = key.data && Array.isArray(key.data.values) ? key.data.values : key.values; // prepare the attribute's values for post-processing (e.g. count)
706
717
  attribute.values = (values || []).map(valuesMapper);}if (key.type === 'checkbox') {// values do not exist in a typical checkbox
707
718
  // but may be there for customization of the labels
708
719
  const values = Array.isArray(key.values) ? key.values : [{ label: translations['Yes'] || context.__('Yes'), value: true }, { label: translations['No'] || context.__('No'), value: false }]; // prepare the attribute's values for post-processing (e.g. count)
709
720
  attribute.values = values.map(valuesMapper);}} // clone attribute
710
721
  let attr = { ...attribute };attr.legend = translations[attr.legend] || attr.legend;attr.title = translations[attr.title] || attr.title;attr.label = translations[attr.label] || attr.label;result.push(attr);}}); // add total = 0 to summaryValues
711
- summaryValues.map((x) => {x.total = 0;return x;});const showResults = await this.showResults(context); // check if zero values should be excluded
712
- const ignoreZeroValues = context.getConfiguration().getSourceAt('settings/evaluation/ignoreZeroValues') || false;if (selectArguments.length && showResults === true) {const responses = await q.select.apply(q, selectArguments).where('evaluationEvent').in(evaluationEvents).silent().getAllItems();for (let i = 0; i < result.length; i++) {const qElement = result[i];qElement.responses = [];if (qElement.isNumber) {// remove zero values from responses avg and std
713
- const sample = responses.filter((x) => {if (ignoreZeroValues) {return x[qElement.name] != 0;}return true;}); // add mean value and standard deviation
714
- qElement.std = sample.length ? math.std(sample.map((x) => {return x[qElement.name];})) : 0;qElement.avg = sample.length ? math.mean(sample.map((x) => {return x[qElement.name];})) : 0;qElement.numberOfResponses = sample.length;summaryValues.forEach((radioValue) => {const result = responses.filter((y) => {return y[qElement.name] == radioValue.value;}).length;radioValue.total += result;totalResponses += result;});qElement.responses = responses.map((x) => {if (x[qElement.name] > 0 && ignoreZeroValues || !ignoreZeroValues) {return x[qElement.name];}});} else {qElement.responses = responses.map((x) => {const value = x[qElement.name]; // if the field type is Json
722
+ summaryValues.map((x) => {x.total = 0;return x;});const showResults = await this.showResults(context); // values to exclude from calculations
723
+ const ignoreZeroValues = context.getConfiguration().getSourceAt('settings/evaluation/ignoreZeroValues') || false;const ignoreValues = context.getConfiguration().getSourceAt('settings/evaluation/ignoreValues') || [];if (ignoreZeroValues) {// add zero value to ignore values array if not exist
724
+ if (!ignoreValues.includes(0)) {ignoreValues.push(0);}}if (selectArguments.length && showResults === true) {const responses = await q.select.apply(q, selectArguments).where('evaluationEvent').in(evaluationEvents).silent().getAllItems();for (let i = 0; i < result.length; i++) {const qElement = result[i];qElement.responses = [];if (qElement.isNumber) {// remove values from responses avg and std
725
+ const sample = responses.filter((x) => {const value = x[qElement.name]; // always ignore null/undefined
726
+ if (value == null) {return false;} // ignore configured values
727
+ return !ignoreValues.includes(value);}); // add mean value and standard deviation
728
+ qElement.std = math.round(sample.length ? math.std(sample.map((x) => {return x[qElement.name];})) : 0, 2);qElement.avg = math.round(sample.length ? math.mean(sample.map((x) => {return x[qElement.name];})) : 0, 2);qElement.numberOfResponses = sample.length;qElement.totalNumberOfResponses = responses.length;summaryValues.forEach((radioValue) => {const result = responses.filter((y) => {return y[qElement.name] == radioValue.value;}).length;radioValue.total += result;totalResponses += result;});qElement.responses = responses.map((x) => {if (x[qElement.name] != null && !ignoreValues.includes(x[qElement.name])) {return x[qElement.name];}});} else {qElement.responses = responses.map((x) => {const value = x[qElement.name]; // if the field type is Json
715
729
  if (qElement.type === 'Json') {// enumerate value keys and consider only truthy values
716
730
  return Object.keys(value).filter((item) => {return !!value[item];});} // else, just return the value
717
- return value;}); // check if the element contains values (post-processing)
718
- if (Array.isArray(qElement.values) && qElement.values.length > 0) {// enumerate them
719
- qElement.values = qElement.values.map((keyValue) => {// and append the count
720
- keyValue.count = qElement.responses.filter((qResponse) => {// if the field's type is Json
721
- if (qElement.type === 'Json') {// count responses which include the item
722
- return (qResponse || []).includes(keyValue.value);} // else, just count flat items
723
- return keyValue.value === qResponse;}).length;return keyValue;});}}}}const results = {};results.responses = result;results.summaryValues = [];results.summaryValues.push.apply(results.summaryValues, summaryValues.map((x) => {x.totalResponses = totalResponses;return x;}));return results;}async showResults(context) {// this is a custom way to get permissions based on eventStatus and user groups
731
+ return value;});} // check if the element contains values (post-processing)
732
+ if (Array.isArray(qElement.values) && qElement.values.length > 0) {// enumerate them
733
+ qElement.values = qElement.values.map((keyValue) => {// and append the count
734
+ keyValue.count = qElement.responses.filter((qResponse) => {// if the field's type is Json
735
+ if (qElement.type === 'Json') {// count responses which include the item
736
+ return (qResponse || []).includes(keyValue.value);} // else, just count flat items
737
+ return keyValue.value == qResponse;}).length;return keyValue;});}}}const results = {};results.responses = result;results.summaryValues = [];results.summaryValues.push.apply(results.summaryValues, summaryValues.map((x) => {x.totalResponses = totalResponses;return x;}));return results;}async showResults(context) {// this is a custom way to get permissions based on eventStatus and user groups
724
738
  let showResults = true;let found = false;const eventStatusesResults = context.getConfiguration().getSourceAt('settings/evaluation/results/statuses') || [];const groupsAllowed = context.getConfiguration().getSourceAt('settings/evaluation/results/groupsAllowed') || [];if (eventStatusesResults.length > 0) {// check if eventStatus is allowed
725
739
  if (groupsAllowed.length > 0) {// but first check if user belongs to allowed groups
726
740
  const userName = context.interactiveUser ? context.interactiveUser.name : context.user.name;const user = await context.model('User').where('name').equal(userName).expand('groups').getItem();found = user.groups.some((r) => groupsAllowed.indexOf(r.name) >= 0);}if (!found) {const evaluationEvent = await context.model('EvaluationEvent').where('id').equal(this.getId()).select('id', 'eventStatus/alternateName as eventStatus').getItem();if (evaluationEvent == null) {throw new _common.HttpNotFoundError('The specified evaluation cannot be found');}showResults = eventStatusesResults.findIndex((x) => {return x === evaluationEvent.eventStatus;}) >= 0;}}return showResults;}findByKey(array, key) {for (let index = 0; index < array.length; index++) {const element = array[index];if (element.key === key) {return element;} else {if (element.components) {const found = this.findByKey(element.components, key);if (found) {return found;}}}}}setParentLegend(component) {if (Array.isArray(component.components)) {component.components.forEach((item) => {if (component.legend) {item.customProperties = item.customProperties || {};item.customProperties.legend = component.legend;}this.setParentLegend(item);});}}async evaluate(data) {const token = await EvaluationAccessToken.inspect(this.context, this.context.user.authenticationToken);if (token.active === false) {throw new _common.HttpTokenExpiredError('Evaluation access token has been expired or is invalid.');}if (this.id !== token.sub) {throw new _common.HttpBadRequestError('Evaluation access token is invalid');} // get evaluation form
@@ -733,10 +747,7 @@ _data.EdmMapping.action('Evaluate', 'Object'), _dec(_class = (_class2 = class Ev
733
747
  for (let i = 0; i < subEvents.length; i++) {context.user.authenticationToken = subEvents[i].access_token;const subEvent = context.model('EvaluationEvent').convert(subEvents[i].id);delete subEvents[i].id;if (subEvents.length > 1 && event.target.instructors) {// check if instructor has been evaluated
734
748
  if (event.target.instructors[subEvent.id] === true) {await subEvent.evaluate(subEvents[i]);}} else {await subEvent.evaluate(subEvents[i]);}}}return context.model(EvaluationAccessToken).silent().save({ access_token: token.access_token, expires: new Date(0), // set epoch date
735
749
  used: true });}).then(() => {return callback();}).catch((err) => {_common.TraceUtils.error('An error occurred while submitting evaluation');return callback(err);});}).silent().save(data);return data;}static async generateTokens(context, generateOptions) {let items = [];if (Array.isArray(generateOptions)) {let n = 0;let newItems; // eslint-disable-next-line no-unused-vars
736
- for (let itemGenerateOptions of generateOptions) {newItems = await EvaluationEvent.generateManyTokens(context, itemGenerateOptions);n += newItems.length;items.push.apply(items, newItems);}await context.model('EvaluationAccessToken').silent().save(items);return n;} else {items = await EvaluationEvent.generateManyTokens(context, generateOptions);await context.model('EvaluationAccessToken').silent().save(items);
737
- return items.length;
738
- }
739
- }
750
+ for (let itemGenerateOptions of generateOptions) {newItems = await EvaluationEvent.generateManyTokens(context, itemGenerateOptions);n += newItems.length;items.push.apply(items, newItems);}await context.model('EvaluationAccessToken').silent().save(items);return n;} else {items = await EvaluationEvent.generateManyTokens(context, generateOptions);await context.model('EvaluationAccessToken').silent().save(items);return items.length;}}
740
751
  /**
741
752
  * Generates a number of access tokens for the given event
742
753
  * @param {DataContext} context
@@ -949,6 +960,13 @@ _data.EdmMapping.action('Evaluate', 'Object'), _dec(_class = (_class2 = class Ev
949
960
 
950
961
  // get avg of questions avg
951
962
  const ignoreZeroValues = context.getConfiguration().getSourceAt('settings/evaluation/ignoreZeroValues') || false;
963
+ const ignoreValues = context.getConfiguration().getSourceAt('settings/evaluation/ignoreValues') || [];
964
+ if (ignoreZeroValues) {
965
+ // add zero value to ignore values array if not exists
966
+ if (!ignoreValues.includes(0)) {
967
+ ignoreValues.push(0);
968
+ }
969
+ }
952
970
  // filter only numbers
953
971
  const filteredResults = results.responses.filter((x) => {
954
972
  return !!x.isNumber;
@@ -956,12 +974,15 @@ _data.EdmMapping.action('Evaluate', 'Object'), _dec(_class = (_class2 = class Ev
956
974
  // filter avg values
957
975
  const filteredByValueResults = filteredResults.
958
976
  filter((x) => {
959
- return ignoreZeroValues && x.avg > 0 || !ignoreZeroValues;
977
+ return ignoreValues && ignoreValues.length > 0 && !ignoreValues.includes(x.avg) || !(ignoreValues && ignoreValues.length > 0);
978
+ //return (ignoreZeroValues && x.avg > 0 || !ignoreZeroValues);
960
979
  });
961
- avg.responsesAvg = filteredByValueResults.length ? math.mean(filteredByValueResults.
980
+ avg.responsesAvg = math.round(filteredByValueResults.length ? math.mean(filteredByValueResults.
962
981
  map((x) => {
963
- return x.avg;
964
- })) : 0;
982
+ if (x.avg != null) {
983
+ return x.avg;
984
+ }
985
+ })) : 0, 0);
965
986
 
966
987
  // get all answers
967
988
  const questionResults = filteredResults.length ? filteredResults.reduce((prev, curr) => {
@@ -974,8 +995,9 @@ _data.EdmMapping.action('Evaluate', 'Object'), _dec(_class = (_class2 = class Ev
974
995
  }
975
996
  return prev;
976
997
  }, []) : [];
977
-
978
- avg.questionsAvg = questionResults.length ? math.mean(questionResults) : 0;
998
+ avg.questionsAvg = math.round(questionResults.length ? math.mean(questionResults.filter((x) => {
999
+ return x != null;
1000
+ })) : 0, 0);
979
1001
  return avg;
980
1002
  }}, (_applyDecoratedDescriptor(_class2, "getCurrent", [_dec2], Object.getOwnPropertyDescriptor(_class2, "getCurrent"), _class2), _applyDecoratedDescriptor(_class2.prototype, "getForm", [_dec3], Object.getOwnPropertyDescriptor(_class2.prototype, "getForm"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "getResults", [_dec4], Object.getOwnPropertyDescriptor(_class2.prototype, "getResults"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "getAccessTokens", [_dec5], Object.getOwnPropertyDescriptor(_class2.prototype, "getAccessTokens"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "getFormAttributes", [_dec6], Object.getOwnPropertyDescriptor(_class2.prototype, "getFormAttributes"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "getFormAttributesSummary", [_dec7], Object.getOwnPropertyDescriptor(_class2.prototype, "getFormAttributesSummary"), _class2.prototype), _applyDecoratedDescriptor(_class2.prototype, "evaluate", [_dec8, _dec9], Object.getOwnPropertyDescriptor(_class2.prototype, "evaluate"), _class2.prototype)), _class2)) || _class);
981
1003