Skip to content

Commit e016c2d

Browse files
Merge branch 'develop' into 'master'
Release: Develop To Master See merge request noluckjustskill/hackathon_training!61
2 parents 96ffc24 + 2fbf1b9 commit e016c2d

File tree

30 files changed

+610
-215
lines changed

30 files changed

+610
-215
lines changed

_tests_/smoke/api.test.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,18 @@ describe('getGolland Endpoint', () => {
5454
});
5555

5656
describe('gollandResults Endpoint', () => {
57-
it('should return dictionary with number for every type', (done) => {
57+
it('should return name, result and description in object for every type', (done) => {
5858
request(app.callback())
5959
.get('/api/gollandResults')
6060
.set('Authorization', token)
6161
.expect(200)
6262
.end((err, res) => {
6363
if (err) done(err);
6464

65-
expect(Object.values(res.body).every(val => isNumber(val))).toBe(true);
65+
expect(Object.values(res.body).every(val => isObject(val))).toBe(true);
66+
expect(Object.values(res.body).every(val => isString(val.name))).toBe(true);
67+
expect(Object.values(res.body).every(val => isString(val.descr))).toBe(true);
68+
expect(Object.values(res.body).every(val => isNumber(val.result))).toBe(true);
6669

6770
done();
6871
});

components/AllTests.vue

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<template>
2+
<div>
3+
<h3 class="title">
4+
Ещё тесты:
5+
</h3>
6+
<v-layout
7+
row
8+
wrap
9+
justify-center
10+
align-center
11+
class="layout"
12+
>
13+
<v-flex
14+
v-for="(test, i) in list"
15+
:key="i"
16+
lg4
17+
sm6
18+
xs12
19+
class="block-wrap"
20+
>
21+
<nuxt-link :to="test.link" class="test-link">
22+
<div class="block">
23+
<v-img
24+
:src="test.icon"
25+
contain
26+
width="100%"
27+
height="120"
28+
/>
29+
<h3 class="subtitle-2 text-center my-2">
30+
{{ test.text }}
31+
</h3>
32+
</div>
33+
</nuxt-link>
34+
</v-flex>
35+
</v-layout>
36+
</div>
37+
</template>
38+
39+
<script>
40+
export default {
41+
props: {
42+
curr: {
43+
type: String,
44+
required: true,
45+
},
46+
},
47+
computed: {
48+
list() {
49+
return this.$constants.allTests.filter(({ name }) => name !== this.curr);
50+
},
51+
},
52+
};
53+
</script>
54+
55+
<style lang="scss" scoped>
56+
.title {
57+
color: rgb(90, 90, 90);
58+
padding-left: 10px;
59+
}
60+
.layout {
61+
padding: 10px;
62+
}
63+
.block-wrap {
64+
padding: 10px;
65+
box-sizing: border-box;
66+
}
67+
.block {
68+
font-size: 18px;
69+
font-weight: 500;
70+
border: 1px solid #E5E5E5;
71+
border-radius: 5px;
72+
padding: 20px 10%;
73+
box-sizing: border-box;
74+
background: white;
75+
}
76+
.test-link {
77+
text-decoration: none;
78+
}
79+
.subtitle-2 {
80+
color: rgba(0, 0, 0, 0.9);
81+
word-break: break-word;
82+
}
83+
</style>

components/CharacterType.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
tile
77
>
88
<v-card-title class="title pb-2">
9-
Склад характера
9+
Характеристика личности
1010
</v-card-title>
1111
<template v-if="!hasDiskResult">
1212
<v-list-item
@@ -29,7 +29,7 @@
2929
<div class="my-3 text-center">
3030
<nuxt-link to="/tests/disk" class="link">
3131
<h4 class="subtitle-1">
32-
Узнать свой склад характера
32+
Узнать свою характеристику личности
3333
<v-icon small>
3434
mdi-open-in-new
3535
</v-icon>

components/Charts/Learning.vue

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
tile
55
>
66
<v-card-title class="title">
7-
Софт скиллы
7+
Тип личности
88
</v-card-title>
99
<Preloader v-if="!myChart && !noData" :width="loaderSize" :height="loaderSize" />
1010
<canvas ref="canvas" height="250" class="px-4" />
1111
<div v-if="myChart && noData" class="my-3 text-center">
1212
<nuxt-link to="/tests/golland" class="link">
1313
<h4 class="subtitle-1">
14-
Узнать свои скиллы
14+
Узнать свой тип личности
1515
<v-icon small>
1616
mdi-open-in-new
1717
</v-icon>
@@ -57,12 +57,16 @@
5757
},
5858
tooltips: {
5959
enabled: true,
60+
height: 120,
6061
callbacks: { // https://github.com/chartjs/Chart.js/issues/6188#issuecomment-497251833
6162
title: (tooltipItems, data) => {
6263
return data.labels[tooltipItems[0].index];
6364
},
6465
label: (tooltipItem, data) => {
6566
return 'Уровень : ' + data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index] + '%';
67+
},
68+
afterLabel: (tooltipItem, data) => {
69+
return data.datasets[tooltipItem.datasetIndex].descr[tooltipItem.index];
6670
}
6771
},
6872
},
@@ -77,6 +81,9 @@
7781
loaderSize() {
7882
return this.$vuetify.breakpoint.smAndDown ? 160 : 250;
7983
},
84+
radarDescrLength() {
85+
return this.$vuetify.breakpoint.mdAndDown ? 48 : 65;
86+
},
8087
},
8188
mounted() {
8289
this.fetchResult();
@@ -86,24 +93,49 @@
8693
const ctx = this.$refs.canvas;
8794
const result = await this.$axios.$get('gollandResults');
8895
89-
this.noData = !Object.values(result).every(Boolean);
96+
if (Array.isArray(result)) {
97+
this.noData = true;
98+
}
9099
91100
if (!this.noData) {
92101
this.$store.commit('updateProfileProgress', 'golland');
93102
}
94103
95-
const config = {
104+
const config = !this.noData ? {
96105
...this.config,
97106
data: {
98107
labels: Object.keys(result),
99108
datasets: [{
100109
backgroundColor: this.bgColor,
101110
pointBackgroundColor: this.$vuetify.theme.themes.light.primary,
102-
data: Object.values(result).map(v => v * 100),
111+
data: Object.values(result).map(v => Math.round(v.result * 100)),
112+
pointRadius: 4,
113+
pointHoverRadius: 5,
114+
descr: Object.values(result).map(v => {
115+
const arr = [];
116+
while (v.descr.length > this.radarDescrLength) {
117+
const a = v.descr.lastIndexOf(' ', this.radarDescrLength);
118+
arr.push(v.descr.substring(0, a));
119+
v.descr = v.descr.substring(a+1, v.descr.length);
120+
}
121+
arr.push(v.descr);
122+
return arr;
123+
}),
103124
}],
104125
},
126+
} : {
127+
...this.config,
128+
data: {
129+
labels: result,
130+
datasets: [{
131+
backgroundColor: this.bgColor,
132+
pointBackgroundColor: this.$vuetify.theme.themes.light.primary,
133+
data: [0, 0, 0, 0, 0, 0],
134+
pointRadius: 4,
135+
pointHoverRadius: 5,
136+
}]
137+
},
105138
};
106-
107139
this.myChart = new Chart(ctx, config);
108140
},
109141
},

components/HeaderBar.vue

Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -37,39 +37,6 @@
3737
</v-tabs>
3838
</v-flex>
3939
</v-layout>
40-
<div class="hidden-md-and-up">
41-
<v-navigation-drawer
42-
v-model="drawer"
43-
clipped
44-
app
45-
hide-overlay
46-
>
47-
<div>
48-
<v-btn icon right @click="drawer = !drawer">
49-
<v-icon>mdi-close</v-icon>
50-
</v-btn>
51-
</div>
52-
<v-list>
53-
<v-list-item
54-
v-for="(item, i) in items"
55-
:key="i"
56-
:to="item.to"
57-
router
58-
exact
59-
>
60-
<v-list-item-action>
61-
<v-icon>{{ item.icon }}</v-icon>
62-
</v-list-item-action>
63-
<v-list-item-content>
64-
<v-list-item-title v-text="item.title" />
65-
</v-list-item-content>
66-
</v-list-item>
67-
</v-list>
68-
</v-navigation-drawer>
69-
<div>
70-
<v-app-bar-nav-icon @click.stop="drawer = !drawer" />
71-
</div>
72-
</div>
7340
</div>
7441
</template>
7542

@@ -90,7 +57,7 @@
9057
},
9158
},
9259
data: () => ({
93-
tab: null,
60+
tab: '/',
9461
drawer: false,
9562
overlay: false
9663
}),

0 commit comments

Comments
 (0)