@baravak/risloo-profile-cli 4.3.3 → 4.3.5

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baravak/risloo-profile-cli",
3
- "version": "4.3.3",
3
+ "version": "4.3.5",
4
4
  "description": "**Risloo Profile CLI** is a library for creating profiles, reports and sheets for *psychological* samples.",
5
5
  "main": "bin/risloo.js",
6
6
  "publishConfig": {
@@ -58,7 +58,7 @@ class JPFQ93 extends Profile {
58
58
  const clinicalScores = clinicalScoring(dataset.questions)
59
59
  const score2 = []
60
60
  dataset.score.forEach(score => {
61
- markSum += score.mark
61
+ markSum += (score.mark ?? 0)
62
62
  const s2= {label: {...score.label}}
63
63
  s2.mark = clinicalScores[score.label.eng].total
64
64
  s2.label.percentage = clinicalScores[score.label.eng].percentage
@@ -76,47 +76,46 @@ class JPFQ93 extends Profile {
76
76
  }
77
77
  }
78
78
  function clinicalScoring(items){
79
- f1 = 'identity'
80
- f2 = 'self_direction'
81
- f3 = 'empathy'
82
- f4 = 'intimacy'
83
- f5 = 'psychoticism'
84
- f6 = 'detachment'
85
- f7 = 'disinhibition'
86
- f8 = 'negative_affectivity'
87
- f9 = 'antagonism'
88
- factors = {
89
- [`${f1}`] : [1,5,9,12,14,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,48,50,53],
90
- [`${f2}`] : [2,6,10,15,20,26,32,38,44,49],
91
- [`${f3}`] : [4,8,13,18,24,30,36,42,47,52,55],
92
- [`${f4}`] : [3,7,11,16,22,28,34,40,46,51,54],
93
- [`${f5}`] : [56,62,68,73,78,83,88,96,102,108,111],
94
- [`${f6}`] : [60,67,72,77,82,87,94,100,106],
95
- [`${f7}`] : [57,61,63,66,69,74,79,84,89,91,93,95,97,103,107,110,114,118,120,122,124,126],
96
- [`${f8}`] : [59,65,71,76,81,86,92,99,105,112,116,119,121,123,125],
97
- [`${f9}`] : [58,64,70,75,80,85,90,98,101,104,109,113,115,117]
98
- }
99
- reverse_scoring_numbers = [1,5,6,10,11,12,14,26,32,34,47,50,115]
100
- result = {}
101
- for(const f in factors){
102
- const fItems = factors[f]
103
- if(result[f] === undefined){
104
- result[f] = {total: 0, percentage: 0, width: fItems.length * 2}
105
- }
106
-
107
- fItems.forEach(index => {
108
- answer = parseInt(items[index -1].user_answered)
79
+ f1 = 'identity'
80
+ f2 = 'self_direction'
81
+ f3 = 'empathy'
82
+ f4 = 'intimacy'
83
+ f5 = 'psychoticism'
84
+ f6 = 'detachment'
85
+ f7 = 'disinhibition'
86
+ f8 = 'negative_affectivity'
87
+ f9 = 'antagonism'
88
+ factors = {
89
+ [`${f1}`] : [1,5,9,12,14,17,19,21,23,25,27,29,31,33,35,37,39,41,43,45,48,50,53],
90
+ [`${f2}`] : [2,6,10,15,20,26,32,38,44,49],
91
+ [`${f3}`] : [4,8,13,18,24,30,36,42,47,52,55],
92
+ [`${f4}`] : [3,7,11,16,22,28,34,40,46,51,54],
93
+ [`${f5}`] : [56,62,68,73,78,83,88,96,102,108,111],
94
+ [`${f6}`] : [60,67,72,77,82,87,94,100,106],
95
+ [`${f7}`] : [57,61,63,66,69,74,79,84,89,91,93,95,97,103,107,110,114,118,120,122,124,126],
96
+ [`${f8}`] : [59,65,71,76,81,86,92,99,105,112,116,119,121,123,125],
97
+ [`${f9}`] : [58,64,70,75,80,85,90,98,101,104,109,113,115,117]
98
+ }
99
+ reverse_scoring_numbers = [1,5,6,10,11,12,14,26,32,34,47,50,115]
100
+ result = {}
101
+ for(const f in factors){
102
+ const fItems = factors[f]
103
+ if(result[f] === undefined){
104
+ result[f] = {total: 0, percentage: 0, width: fItems.length * 2}
105
+ }
106
+ fItems.forEach(index => {
107
+ answer = parseInt(items[index -1].user_answered)
109
108
  let incScore = 0
110
- if(reverse_scoring_numbers.indexOf(index) === -1){
111
- incScore = Math.floor((4 - answer)/1.5)
112
- }else{
113
- incScore = Math.floor((answer - 1)/1.5)
114
- }
115
- result[f].total = result[f].total + incScore
116
- })
117
- totalScore = fItems.length * 2
118
- result[f].percentage = Math.round((result[f].total * 100) / totalScore)
119
- }
120
- return result
109
+ if(reverse_scoring_numbers.indexOf(index) === -1){
110
+ incScore = Math.floor((answer - 1)/1.5)
111
+ }else{
112
+ incScore = Math.floor((4 - answer)/1.5)
113
+ }
114
+ result[f].total = result[f].total + incScore
115
+ })
116
+ totalScore = fItems.length * 2
117
+ result[f].percentage = Math.round((result[f].total * 100) / totalScore)
118
+ }
119
+ return result
121
120
  }
122
121
  module.exports = JPFQ93;