@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.
@@ -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
+ }
@@ -472,8 +472,8 @@ class EvaluationEvent extends DataObject {
472
472
  attribute.values = (key.values || []).map(valuesMapper);
473
473
  }
474
474
  }
475
- if (!attribute.isNumber) {
476
- if (['select', 'selectboxes'].includes(key.type)) {
475
+ if (!attribute.isNumber || (attribute.isNumber && key.type === 'radio')) {
476
+ if (['select', 'selectboxes','radio'].includes(key.type)) {
477
477
  const values = (key.data && Array.isArray(key.data.values))
478
478
  ? key.data.values
479
479
  : key.values;
@@ -508,31 +508,42 @@ class EvaluationEvent extends DataObject {
508
508
  return x;
509
509
  });
510
510
  const showResults = await this.showResults(context);
511
- // check if zero values should be excluded
511
+ // values to exclude from calculations
512
512
  const ignoreZeroValues = context.getConfiguration().getSourceAt('settings/evaluation/ignoreZeroValues') || false;
513
+ const ignoreValues = context.getConfiguration().getSourceAt('settings/evaluation/ignoreValues') || [];
514
+ if (ignoreZeroValues) {
515
+ // add zero value to ignore values array if not exist
516
+ if (!ignoreValues.includes(0)) {
517
+ ignoreValues.push(0);
518
+ }
519
+ }
513
520
  if (selectArguments.length && showResults === true) {
514
521
  const responses = await q.select.apply(q, selectArguments).where('evaluationEvent').in(evaluationEvents).silent().getAllItems();
515
522
  for (let i = 0; i < result.length; i++) {
516
523
  const qElement = result[i];
517
524
  qElement.responses=[];
518
525
  if (qElement.isNumber) {
519
- // remove zero values from responses avg and std
526
+ // remove values from responses avg and std
520
527
  const sample = responses.filter(x=> {
521
- if (ignoreZeroValues) {
522
- return x[qElement.name] != 0;
528
+ const value = x[qElement.name];
529
+ // always ignore null/undefined
530
+ if (value == null) {
531
+ return false;
523
532
  }
524
- return true;
533
+ // ignore configured values
534
+ return !ignoreValues.includes(value);
525
535
  });
526
536
  // add mean value and standard deviation
527
- qElement.std = sample.length? math.std(sample
537
+ qElement.std =math.round(sample.length? math.std(sample
528
538
  .map(x => {
529
539
  return x[qElement.name];
530
- })):0;
531
- qElement.avg = sample.length? math.mean(sample
540
+ })):0,2);
541
+ qElement.avg =math.round(sample.length? math.mean(sample
532
542
  .map(x => {
533
543
  return x[qElement.name];
534
- })):0;
544
+ })):0,2);
535
545
  qElement.numberOfResponses = sample.length;
546
+ qElement.totalNumberOfResponses =responses.length
536
547
  summaryValues.forEach(radioValue => {
537
548
  const result = responses.filter(y => {
538
549
  return y[qElement.name] == radioValue.value;
@@ -541,7 +552,7 @@ class EvaluationEvent extends DataObject {
541
552
  totalResponses += result;
542
553
  });
543
554
  qElement.responses = responses.map(x => {
544
- if ((x[qElement.name]>0 && ignoreZeroValues) || !ignoreZeroValues) {
555
+ if (x[qElement.name] !=null && !ignoreValues.includes(x[qElement.name])) {
545
556
  return x[qElement.name];
546
557
  }
547
558
  });
@@ -558,6 +569,7 @@ class EvaluationEvent extends DataObject {
558
569
  // else, just return the value
559
570
  return value;
560
571
  });
572
+ }
561
573
  // check if the element contains values (post-processing)
562
574
  if (Array.isArray(qElement.values) && qElement.values.length > 0) {
563
575
  // enumerate them
@@ -570,14 +582,13 @@ class EvaluationEvent extends DataObject {
570
582
  return (qResponse || []).includes(keyValue.value);
571
583
  }
572
584
  // else, just count flat items
573
- return keyValue.value === qResponse;
585
+ return keyValue.value == qResponse;
574
586
  }).length;
575
587
  return keyValue;
576
588
  });
577
589
  }
578
590
  }
579
591
  }
580
- }
581
592
  const results={};
582
593
  results.responses = result;
583
594
  results.summaryValues = [];
@@ -949,6 +960,13 @@ class EvaluationEvent extends DataObject {
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 @@ class EvaluationEvent extends DataObject {
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 @@ class EvaluationEvent extends DataObject {
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
  }
981
1003
  }