@baravak/risloo-profile-cli 4.2.4 → 4.2.6

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.
@@ -1,6 +1,6 @@
1
1
  const { Profile, FS } = require("../Profile");
2
2
 
3
- class _16PF extends Profile {
3
+ class _16PF93 extends Profile {
4
4
  // Number of pages
5
5
  static pages = 1;
6
6
 
@@ -18,7 +18,7 @@ class _16PF extends Profile {
18
18
  L10: { eng: "m", fr: "M", right: "عمل‌گرا", left: "کولی‌باز" },
19
19
  L11: { eng: "n", fr: "N", right: "بی‌ظرافت", left: "ظرافت" },
20
20
  L12: { eng: "o", fr: "O", right: "اطمینان به خود", left: "مستعد احساس گناه" },
21
- L13: { eng: "q1", fr: "Q1", right: "باز بودن نسبت به تغییر", left: "بنیادگرا" },
21
+ L13: { eng: "q1", fr: "Q1", right: "محافظه‌کار", left: "بنیادگرا" },
22
22
  L14: { eng: "q2", fr: "Q2", right: "متکی بر خود", left: "مسلط به دیگران" },
23
23
  L15: { eng: "q3", fr: "Q3", right: "اختلال‌مدار", left: "کمال‌گرا" },
24
24
  L16: { eng: "q4", fr: "Q4", right: "آرام", left: "اضطراب" },
@@ -42,7 +42,7 @@ class _16PF extends Profile {
42
42
  multiProfile: false /* Whether the sample has multiple profiles or not */,
43
43
  questions: false /* Determines whether to get questions from inital dataset or not */,
44
44
  defaultFields: true /* Determines whether to have default prerequisites in the profile or not */,
45
- fields: ["marital_status"] /* In case you want to get some additional fields and show in the profile */,
45
+ fields: [] /* In case you want to get some additional fields and show in the profile */,
46
46
  },
47
47
  /* "profile" determines the dimensions of the drawn profile (to be used in svg tag viewbox) */
48
48
  /* calculating its dimensions carefully is of great importance */
@@ -155,4 +155,4 @@ class _16PF extends Profile {
155
155
  }
156
156
  }
157
157
 
158
- module.exports = _16PF;
158
+ module.exports = _16PF93;
@@ -0,0 +1,114 @@
1
+ const { Profile, FS } = require("../Profile");
2
+
3
+ class _16PF9A extends Profile {
4
+ // Number of pages
5
+ static pages = 1;
6
+
7
+ // Labels of the sample
8
+ labels = {
9
+ L1: { eng: "a", fr: "A", right: "مردم‌گریزی", left: "مردم‌آمیزی" },
10
+ L2: { eng: "b", fr: "B", right: "استدلال عینی", left: "استدلال انتزاعی" },
11
+ L3: { eng: "c", fr: "C", right: "ناپایداری هیجانی", left: "پایداری هیجانی" },
12
+ L4: { eng: "e", fr: "E", right: "سلطه‌پذیری", left: "سلطه‌گری" },
13
+ L5: { eng: "f", fr: "F", right: "دل‌مردگی", left: "سرزندگی" },
14
+ L6: { eng: "g", fr: "G", right: "مصلحت‌گرا", left: "باوجدان" },
15
+ L7: { eng: "h", fr: "H", right: "ترسو", left: "جسور" },
16
+ L8: { eng: "i", fr: "I", right: "یکدنده", left: "حساس" },
17
+ L9: { eng: "l", fr: "L", right: "زودباور", left: "شکاک" },
18
+ L10: { eng: "m", fr: "M", right: "عمل‌گرا", left: "کولی‌باز" },
19
+ L11: { eng: "n", fr: "N", right: "بی‌ظرافت", left: "ظرافت" },
20
+ L12: { eng: "o", fr: "O", right: "اطمینان به خود", left: "مستعد احساس گناه" },
21
+ L13: { eng: "q1", fr: "Q1", right: "باز بودن نسبت به تغییر", left: "بنیادگرا" },
22
+ L14: { eng: "q2", fr: "Q2", right: "متکی بر خود", left: "مسلط به دیگران" },
23
+ L15: { eng: "q3", fr: "Q3", right: "اختلال‌مدار", left: "کمال‌گرا" },
24
+ L16: { eng: "q4", fr: "Q4", right: "آرام", left: "اضطراب" },
25
+ L17: { eng: "extraversion", fr: "برون‌گرایی" },
26
+ L18: { eng: "anxiety", fr: "اضطراب" },
27
+ L19: { eng: "flexibility", fr: "یک‌دندگی" },
28
+ L20: { eng: "independence", fr: "استقلال" },
29
+ L21: { eng: "selfcontrol", fr: "کنترل بالا" },
30
+ L22: { eng: "adjustment", fr: "سازگاری" },
31
+ L23: { eng: "leadership", fr: "قدرت رهبری" },
32
+ L24: { eng: "creativity", fr: "خلاقیت" },
33
+ L25: { eng: "status", fr: "وضعیت" },
34
+ };
35
+
36
+ profileSpec = {
37
+ /* "sample" determines some important info about the sample and profile */
38
+ /* Default prerequisites: 1. gender, 2. age, 3. education */
39
+ /* "prerequisites" is synonym to "fields" in our program */
40
+ sample: {
41
+ name: "پرسشنامه شخصیت کتل" /* Name of the sample */,
42
+ multiProfile: false /* Whether the sample has multiple profiles or not */,
43
+ questions: false /* Determines whether to get questions from inital dataset or not */,
44
+ defaultFields: true /* Determines whether to have default prerequisites in the profile or not */,
45
+ fields: [] /* In case you want to get some additional fields and show in the profile */,
46
+ },
47
+ /* "profile" determines the dimensions of the drawn profile (to be used in svg tag viewbox) */
48
+ /* calculating its dimensions carefully is of great importance */
49
+ profile: {
50
+ get dimensions() {
51
+ return {
52
+ width: 522 + 2 * this.padding.x,
53
+ height: 557 + 2 * this.padding.y,
54
+ };
55
+ },
56
+ padding: {
57
+ x: 190.5,
58
+ y: 78.5,
59
+ },
60
+ },
61
+ items: {
62
+ minValue: 1,
63
+ maxValue: 10,
64
+ offsetY: 33.8,
65
+ widthCoeff: 16.2,
66
+ fillAndOpacity: {
67
+ 1: { fill: "#1D4ED8", opacity: 1 },
68
+ 2: { fill: "#1D4ED8", opacity: 0.9 },
69
+ 3: { fill: "#1D4ED8", opacity: 0.8 },
70
+ 4: { fill: "#1D4ED8", opacity: 0.7 },
71
+ 5: { fill: "#9CA3AF", opacity: 1 },
72
+ 6: { fill: "#9CA3AF", opacity: 1 },
73
+ 7: { fill: "#0E7490", opacity: 0.7 },
74
+ 8: { fill: "#0E7490", opacity: 0.8 },
75
+ 9: { fill: "#0E7490", opacity: 0.9 },
76
+ 10: { fill: "#0E7490", opacity: 1 },
77
+ },
78
+ label: {
79
+ offsetX: 16.2,
80
+ },
81
+ },
82
+ /* "labels" part which has to be provided for each profile */
83
+ labels: Object.values(this.labels),
84
+ };
85
+
86
+ constructor(dataset, options, config = {}) {
87
+ super();
88
+ this._init(dataset, options, config);
89
+ }
90
+
91
+ _calcContext() {
92
+ const {
93
+ spec: { parameters: spec },
94
+ dataset,
95
+ } = this;
96
+
97
+ const { items: itemsSpec } = spec;
98
+
99
+ const status = dataset.score.pop().mark;
100
+
101
+ const genderValue = dataset.info.fields.find((f) => f["eng"] === "gender").value;
102
+
103
+ const items = dataset.score.slice(0, 16).map((data) => ({
104
+ label: data.label,
105
+ mark: data.mark,
106
+ offset: (data.mark - 1) * itemsSpec.widthCoeff,
107
+ ...itemsSpec.fillAndOpacity[data.mark],
108
+ }));
109
+
110
+ return [{ items, status }];
111
+ }
112
+ }
113
+
114
+ module.exports = _16PF9A;
@@ -67,7 +67,10 @@ class JPFQ93 extends Profile {
67
67
  // },
68
68
  // }));
69
69
  // markSum = 378
70
- return [{ markSum: markSum }];
70
+ this.dataset.score.forEach((f, i) => {
71
+ this.dataset.score[i].label.percentage = Math.round(((this.dataset.score[i].mark * 100) / this.dataset.score[i].label.width))
72
+ })
73
+ return [{ markSum }];
71
74
  }
72
75
  }
73
76
 
@@ -0,0 +1,57 @@
1
+ {{#> layout}}
2
+
3
+ <g transform="translate({{spec.profile.padding.x}}, {{spec.profile.padding.y}})">
4
+ <g transform="translate(121.5, 23.5)">
5
+ <g transform="translate(64.6, -23)">
6
+ {{#if (boolean status '!==' "invalid")}}
7
+ <rect x="0" y="0" width="46.8" height="16.2" rx="3.6" fill="#FEE2E2" />
8
+ <text x="23.4" y="8.1" fill="#B91C1C" font-size="12.6" font-weight="400" text-anchor="middle" dy="3">نامعتبر</text>
9
+ {{/if}}
10
+ </g>
11
+ <text x="8" y="-20" dy="1em" font-size="12" font-weight="400" fill="#155E75" text-anchor="middle">10</text>
12
+ <text x="168" y="-20" dy="1em" font-size="12" font-weight="400" fill="#155E75" text-anchor="middle">0</text>
13
+
14
+ <rect x="0" y="0" width="16" height="514" fill="#1D4ED8" fill-opacity="0.1" rx="3.6" />
15
+ <rect x="16" y="0" width="16" height="514" fill="#1D4ED8" fill-opacity="0.07" rx="3.6" />
16
+ <rect x="32" y="0" width="16" height="514" fill="#1D4ED8" fill-opacity="0.05" rx="3.6" />
17
+
18
+ <rect x="48" y="0" width="16" height="514" fill="#E5E7EB" fill-opacity="0.2" rx="3.6" />
19
+ <rect x="64" y="0" width="16" height="514" fill="#E5E7EB" fill-opacity="0.1" rx="3.6" />
20
+
21
+ <rect x="96" y="0" width="16" height="514" fill="#E5E7EB" fill-opacity="0.1" rx="3.6" />
22
+ <rect x="112" y="0" width="16" height="514" fill="#E5E7EB" fill-opacity="0.2" rx="3.6" />
23
+
24
+ <rect x="128" y="0" width="16" height="514" fill="#0E7490" fill-opacity="0.05" rx="3.6" />
25
+ <rect x="144" y="0" width="16" height="514" fill="#0E7490" fill-opacity="0.07" rx="3.6" />
26
+ <rect x="160" y="0" width="16" height="514" fill="#0E7490" fill-opacity="0.1" rx="3.6" />
27
+ {{!-- {{#each items as | item index |}}
28
+ {{#with @root.spec.items as | itemsSpec |}}
29
+ <g transform="translate(0, {{math index '*' itemsSpec.offsetY}})">
30
+ <g transform="translate(0, 7.2)">
31
+ <line x1="18" y1="0" x2="-147.6" y2="0" stroke="#E4E4E7" />
32
+ <g font-size="14.4" font-weight="400">
33
+ <text x="220" y="0" fill="#71717A" font-weight="500" text-anchor="middle" dy="3">{{item.label.fr}}</text>
34
+ <text x="32.4" y="0" fill="#1E40AF" text-anchor="end" dy="3">{{item.label.right}}</text>
35
+ <text x="-162.5" y="0" fill="#155E75" text-anchor="start" dy="3">{{item.label.left}}</text>
36
+ </g>
37
+ </g>
38
+ <g transform="translate(-{{item.offset}}, 0)">
39
+ <rect x="0" y="0" width="16.2" height="16.2" fill="{{item.fill}}" fill-opacity="{{item.opacity}}" rx="3.6" />
40
+ <text x="8.1" y="8.1" fill="#FFFFFF" font-size="12.6" font-weight="400" text-anchor="middle" dy="3.5">{{item.mark}}</text>
41
+ </g>
42
+ </g>
43
+ {{/with}}
44
+ {{/each}} --}}
45
+ </g>
46
+ <g transform="translate(0, 21.5)">
47
+ {{#each items as | item index |}}
48
+ <g transform="translate(0, {{math 33.3 '*' index}})">
49
+ <line x1="119.5" y1="10" x2="121.5" y2="10" stroke="#D1D5DB" stroke-width="2" />
50
+ <line x1="121.5" y1="10" x2="297.5" y2="10" stroke="#E5E7EB" stroke-width="2" />
51
+ <line x1="297.5" y1="10" x2="299.5" y2="10" stroke="#D1D5DB" stroke-width="2" />
52
+ </g>
53
+ {{/each}}
54
+ </g>
55
+ </g>
56
+
57
+ {{/layout}}
@@ -2,14 +2,18 @@
2
2
  <g transform="translate(0, {{math 5 '+' ( math 51 '*' @key )}})">
3
3
  <text y="0" x="169" text-anchor="start" font-size="24px" font-weight="400" dy="24px" fill="#3F3F46">{{label.fr}}</text>
4
4
  <g transform="translate(186, 0)">
5
- {{bar (math label.width '*' 4.5) 30 (object tl=0 tr=15 bl=0 br=15) (toRad 0) fill=label.background opacity='.8'}}
6
- {{bar (math mark '*' 4.5) 30 (object tl=0 tr=15 bl=0 br=15) (toRad 0) fill=label.fill opacity='.8'}}
7
- <text y="17" x="{{math (math label.width '*' 4.5) '+' 7.5 }}" dy="6px" text-anchor="start" direction="ltr">
8
- <tspan fill="{{label.fill}}" font-size="36px" font-weight="500">
5
+ {{bar (math label.width '*' 3.5) 30 (object tl=0 tr=15 bl=0 br=15) (toRad 0) fill=label.background opacity='.8'}}
6
+ {{bar (math mark '*' 3.5) 30 (object tl=0 tr=15 bl=0 br=15) (toRad 0) fill=label.fill opacity='.8'}}
7
+ <text y="17" x="{{math (math label.width '*' 3.5) '+' 8 }}" dy="6px" text-anchor="start" direction="ltr">
8
+ <tspan fill="{{label.fill}}" font-size="27px" font-weight="500">
9
9
  {{mark}}
10
10
  </tspan>
11
- <tspan font-size="24px" fill="#71717A" font-weight="400">/ {{label.width}}</tspan>
12
- </text>
11
+ <tspan font-size="20px" fill="#71717A" font-weight="400">/ {{label.width}}</tspan>
12
+ </text>
13
+ <g transform="translate({{math 95 '+' (math label.width '*' 3.5)}}, 4)">
14
+ <rect x="0" y="0" rx="4" fill="#F8FAFC" width="50" height="25" />
15
+ <text x="25" y="12.5" dy="0.25em" text-anchor="middle" font-weight="400" font-size="20px" fill="{{label.fill}}">%{{label.percentage}}</text>
16
+ </g>
13
17
  </g>
14
18
  </g>
15
19
  {{/each}}