@baravak/risloo-profile-cli 4.3.0 → 4.3.1

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.0",
3
+ "version": "4.3.1",
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": {
@@ -1,5 +1,4 @@
1
1
  const { Profile, FS, Mappings } = require("../Profile");
2
-
3
2
  class YSQ93 extends Profile {
4
3
  // Number of pages
5
4
  static pages = 1;
@@ -74,31 +73,31 @@ class YSQ93 extends Profile {
74
73
  const a6 = [];
75
74
  let start = 0;
76
75
  const a5_line = [32]
77
- for(let j = 0; j < 5; j++){
78
- const key = i + (j * 18);
79
- if(dataset.questions[key].user_answered == 5){
80
- if(!a5.length){
81
- start+= 37
82
- }else{
83
- start+= 26
84
- }
85
- a5.push({item: key+1, start:start})
76
+ factors_key[s.label.eng].forEach((e, ei) => {
77
+ e = parseInt(e)
78
+ if(dataset.questions[e - 1].user_answered == 5){
79
+ if(!a5.length){
80
+ start+= 37
81
+ }else{
82
+ start+= 26
86
83
  }
87
- }
84
+ a5.push({item: e, start:start})
85
+ }
86
+ });
88
87
  a5_line.push(start + 2)
89
88
  const a6_start = start ? start + 36 : 0;
90
89
  const a6_line = [a6_start + 32]
91
- for(let j = 0; j < 5; j++){
92
- const key = i + (j * 18);
93
- if(dataset.questions[key].user_answered == 6){
94
- if(!a6.length){
95
- start = a6_start + 37
96
- }else{
97
- start+= 26
98
- }
99
- a6.push({item: key+1, start:start})
90
+ factors_key[s.label.eng].forEach((e, ei) => {
91
+ e = parseInt(e)
92
+ if(dataset.questions[e -1].user_answered == 6){
93
+ if(!a6.length){
94
+ start = a6_start + 37
95
+ }else{
96
+ start+= 26
100
97
  }
98
+ a6.push({item: e, start:start})
101
99
  }
100
+ })
102
101
  a6_line.push(start + 2)
103
102
  const is_critical = a5.length + a6.length >= 3 ? true : false
104
103
  return Object.assign({}, s, {
@@ -118,5 +117,39 @@ class YSQ93 extends Profile {
118
117
  return [{ items }];
119
118
  }
120
119
  }
120
+ const f1= 'ed'
121
+ const f2 = 'ab'
122
+ const f3 = 'ma'
123
+ const f4 = 'si'
124
+ const f5 = 'ds'
125
+ const f6 = 'fa'
126
+ const f7 = 'ai'
127
+ const f8 = 'vu'
128
+ const f9 = 'eu'
129
+ const f10 = 'sb'
130
+ const f11 = 'ss'
131
+ const f12 = 'ei'
132
+ const f13 = 'us'
133
+ const f14 = 'et'
134
+ const f15 = 'is'
135
+ const f16 = 'as'
136
+ const f17 = 'np'
137
+ const f18 = 'pu'
121
138
 
139
+ const factors_item = {
140
+ 1: f1, 2: f2, 3: f3, 4: f4, 5: f5, 6: f6, 7: f7, 8: f8, 9: f9, 10: f10, 11: f11, 12: f12, 13: f13, 14: f14, 15: f15, 16: f16, 17: f17, 18: f18,
141
+ 19: f1, 20: f2, 21: f3, 22: f4, 23: f5, 24: f6, 25: f7, 26: f8, 27: f9, 28: f10, 29: f11, 30: f12, 31: f13, 32: f14, 33: f15, 34: f16, 35: f17, 36: f18,
142
+ 37: f1, 38: f2, 39: f3, 40: f4, 41: f5, 42: f6, 43: f7, 44: f8, 45: f9, 46: f10, 47: f11, 48: f12, 49: f13, 50: f14, 51: f15, 52: f16, 53: f17, 54: f18,
143
+ 55: f1, 56: f2, 57: f3, 58: f4, 59: f5, 60: f6, 61: f7, 62: f8, 63: f9, 64: f10, 65: f11, 66: f12, 67: f13, 68: f14, 69: f15, 70: f16, 71: f17, 72: f18,
144
+ 73: f1, 74: f2, 75: f3, 76: f4, 77: f5, 78: f6, 79: f7, 80: f8, 81: f9, 82: f10, 83: f11, 84: f12, 85: f13, 86: f14, 87: f15, 88: f16, 89: f17, 90: f18
145
+ }
146
+ const factors_key = {}
147
+ for(const fi in factors_item){
148
+ const fk = factors_item[fi]
149
+ if(factors_key[fk] === undefined){
150
+ factors_key[fk] = [fi]
151
+ }else{
152
+ factors_key[fk].push(fi)
153
+ }
154
+ }
122
155
  module.exports = YSQ93;