forked from skyeng/grades
-
Notifications
You must be signed in to change notification settings - Fork 1
/
en.html
220 lines (213 loc) · 10 KB
/
en.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<!doctype html>
<html lang="en">
<head>
<title>Grading calculator</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="//cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU" crossorigin="anonymous">
<script src="//cdn.jsdelivr.net/npm/[email protected]/lodash.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/vue@2"></script>
<style>
.textarea {
display: block;
width: 100%;
overflow: hidden;
resize: both;
min-height: 60px;
line-height: 20px;
border: 1px solid #ccc;
padding: 5px;
}
.textarea[contenteditable]:empty::before {
content: "Provide at least 2 examples here";
color: #cccccc;
}
</style>
</head>
<body>
<div id="app" class="container py-4 mt-4">
<header class="pb-1 mb-4 border-bottom">
<a href="#" class="d-flex align-items-center text-dark text-decoration-none">
<span class="fs-4">🚀 Grading calculator</span>
</a>
</header>
<div class="p-2 mb-4 bg-light rounded-3">
<div class="container-fluid py-1 collapse-horizontal">
<h1 class="display-5 fw-bold pb-3">About the grading</h1>
<div>
<div class="col-md-8 fs-6">
Grading is a system that allows simplifies building an individual development plan for a developer through an evaluation system.
</div>
<div class="col-md-8 fs-6">
The grade system for developers consists of 2 parts and includes:
<ul>
<li>Performance evaluation based on criteria. Format: self-assessment + manager's assessment. Colleagues and experts may be involved upon request</li>
<li>Hard skills evaluation (optional).</li>
</ul>
</div>
<div class="col-md-8 fs-6 mt-4">
Questions marked with a <b>*</b> are key. If the performance on a key issue matches the middle level, then
in case of scoring at the senior level, the assessment will not be higher than middle.
</div>
<div class="col-md-8 fs-6 mt-4">
Given that the assessment is quite subjective, choose manifestations that have occurred most often over the last 3-6 months.
If in doubt between two, choose the lower manifestation.
</div>
</div>
<a href="#questions" class="btn btn-primary btn-lg mt-5" type="button" @click.prevent="start" v-show="!started">Start evaluation</a>
</div>
</div>
<div class="row">
<div class="container" id="questions" v-show="started">
<div v-for="question in questions" v-bind:id="question.id">
<div class="question ml-sm-5 pl-sm-5 pb-2" v-show="show(question.number)">
<figure>
<blockquote class="blockquote pt-4">
<h5>{{ question.number }}/{{ questionsCount }}. {{ question.subject }}<span
v-if="question.isKeyQuestion">*</span></h5>
</blockquote>
<figcaption class="blockquote-footer" v-show="question.description" v-html="question.description">
</figcaption>
<small v-if="question.examples"><div class="card card-body" v-html="question.examples"></div></small>
</figure>
<div class="ml-md-3 ml-sm-3 pl-md-5 pt-sm-0 pt-3 options-container">
<div class="form-check py-1" v-for="choice in question.choices" v-bind:id="choice.value">
<input class="form-check-input" type="radio" :name="'question_' + question.id"
:id="'question_' + question.id + '_' + choice.value"
@change="answer(question.id, choice.value)">
<label class="form-check-label" :for="'question_' + question.id + '_' + choice.value">{{ choice.choice }}</label>
<div id="emailHelp" class="form-text" v-if="choice.description">{{ choice.description }}</div>
</div>
</div>
<div class="ml-md-3 ml-sm-3 pl-md-5 pt-sm-0 pt-3 mt-3">
<span class="textarea" role="textbox" contenteditable></span>
</div>
</div>
</div>
<div class="mt-5" v-show="lastAnsweredNumber === questionsCount">
<h4>Grade, taking into account key <b>*</b> items: {{ realGrade.name }}</h4>
<div style="margin-top: 20px">
<span>Points scored: {{ userScore }} / {{ maxScore }}</span>
<ul>
<li v-for="gradeStep in grades">{{ gradeStep.name }} >= {{ gradeStep.score }}</li>
</ul>
</div>
</div>
</div>
</div>
<footer class="pt-3 mt-4 text-muted border-top">
Originally created for SkyEng © 2024
</footer>
</div>
<script>
const params = new URLSearchParams(window.location.search);
const type = params.get('type');
fetch(`grades/${type}.en.json`)
.then(response => response.json())
.then(data => {
new Vue({
el: '#app',
data: {
test: data.quiz,
grades: data.levels,
result: [],
lastAnsweredNumber: 0,
started: false
},
computed: {
questions: function () {
let ordered = _.orderBy(_.filter(this.test, 'isActive'), ['position']);
let result = [];
let number = 1;
ordered.forEach(item => {
item.number = number++;
result.push(item);
});
return result;
},
maxScore() {
return _.filter(this.test, 'isActive').length * 3;
},
userScore() {
let score = 0;
this.result.forEach(item => {
score += item.value;
});
return score;
},
questionsCount() {
return _.filter(this.test, 'isActive').length;
},
estimatedGrade: function () {
return this.calculateGrade(this.grades, this.userScore, 3);
},
realGrade: function () {
let maxLevel = 3;
this.result.forEach(item => {
if (this.getById(item.id).isKeyQuestion && item.value < maxLevel) {
maxLevel = item.value;
}
});
let result = this.calculateGrade(this.grades, this.userScore, maxLevel);
if (!result) {
result = _.orderBy(this.grades, ['score'], ['asc'])[0];
}
return result;
}
},
methods: {
answer: function (questionId, value) {
const answer = _.find(this.result, {id: questionId});
if (!answer) {
this.result.push({
id: questionId,
value: value
});
} else {
answer.value = value;
}
const question = _.find(this.test, {id: questionId});
if (question.number > this.lastAnsweredNumber) {
this.lastAnsweredNumber = question.number;
}
},
calculateGrade: function (grades, userScore, levelLimit) {
let found = false,
tmpGrades = [];
grades.forEach(grade => {
if (grade.score <= userScore && grade.level <= levelLimit) {
tmpGrades.push(grade);
if (!found) {
found = true;
}
}
})
if (!found) {
return _.orderBy(grades, ['score'], ['asc'])[0];
} else {
return _.orderBy(tmpGrades, ['score'], ['desc'])[0];
}
},
getById: function (questionId) {
return _.find(this.test, {id: questionId});
},
getFirstId: function () {
return this.result[0] || null;
},
show: function (questionNumber) {
return questionNumber === 1 || this.lastAnsweredNumber >= questionNumber - 1;
},
start: function () {
this.started = true;
}
}
});
})
.catch(error => console.error('Error:', error));
</script>
<script src="//cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"
integrity="sha384-/bQdsTh/da6pkI1MST/rWKFNjaCP5gBSY4sEBT38Q/9RBh9AH40zEOg7Hlq2THRZ"
crossorigin="anonymous"></script>
</body>
</html>