Skip to content

Commit 535de22

Browse files
Merge branch 'develop' into 'master'
Release: Develop To Master See merge request noluckjustskill/hackathon_training!53
2 parents 08831b7 + bbb47d6 commit 535de22

35 files changed

+3638
-579
lines changed

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ RUN npm install
2323
ARG base_url
2424
ARG browser_base_url
2525
ARG yandex_metrika
26+
ARG sentry_dsn
2627
ENV BASE_URL $base_url
2728
ENV BROWSER_BASE_URL $browser_base_url
2829
ENV YANDEX_METRIKA $yandex_metrika
30+
ENV SENTRY_DSN $sentry_dsn
2931

3032
RUN npm run build

_tests_/smoke/api.test.js

Lines changed: 107 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe('Login Endpoint', () => {
2222

2323
done();
2424
});
25-
});
25+
}, 10000);
2626
});
2727

2828
//=================Golland============================
@@ -122,7 +122,7 @@ describe('getKlimov Endpoint', () => {
122122
});
123123

124124
describe('klimovResults Endpoint', () => {
125-
it('should return dictionary with information about suitable type', (done) => {
125+
it('should return array of dictionaries with information about types', (done) => {
126126
request(app.callback())
127127
.get('/api/klimovResults')
128128
.set('Authorization', token)
@@ -131,7 +131,111 @@ describe('klimovResults Endpoint', () => {
131131
if (err) done(err);
132132

133133
expect(res.statusCode).toEqual(200);
134-
expect(Object.values(res.body).every(val => !isObject(val))).toBe(true);
134+
expect(res.body.every(cur => {
135+
return Object.values(cur).every(val => !isObject(val));
136+
})).toBe(true);
137+
// expect(res.body.every(cur => {
138+
// return (difference(Object.keys(cur),
139+
// ['id', 'name', 'image', 'shortText', 'fullText', 'result']).length === 0);
140+
// })).toBe(true);
141+
142+
done();
143+
});
144+
});
145+
});
146+
147+
//=================Belbin=============================
148+
149+
describe('getBelbin Endpoint', () => {
150+
it('should return arrays with 8 strings - variants for Belbin test', (done) => {
151+
request(app.callback())
152+
.get('/api/getBelbin')
153+
.set('Authorization', token)
154+
.expect(200)
155+
.end((err, res) => {
156+
if (err) done(err);
157+
158+
expect(res.statusCode).toEqual(200);
159+
expect(res.body.every(cur => ( Array.isArray(cur) ))).toBe(true);
160+
expect(res.body.every(cur => ( cur.length === 8 ) )).toBe(true);
161+
expect(res.body.every(cur => {
162+
return cur.every(elem => {
163+
return Object.values(elem).every(element => isString(element));
164+
});
165+
})).toBe(true);
166+
167+
done();
168+
});
169+
});
170+
});
171+
172+
describe('belbinResults Endpoint', () => {
173+
it('should return array of dictionaries with information about types', (done) => {
174+
request(app.callback())
175+
.get('/api/belbinResults')
176+
.set('Authorization', token)
177+
.expect(200)
178+
.end((err, res) => {
179+
if (err) done(err);
180+
181+
expect(res.statusCode).toEqual(200);
182+
expect(res.body.every(cur => {
183+
return Object.values(cur).every(val => !isObject(val));
184+
})).toBe(true);
185+
// expect(res.body.every(cur => {
186+
// return (difference(Object.keys(cur), ['id', 'name', 'image', 'descr', 'func', 'result']).length === 0);
187+
// })).toBe(true);
188+
189+
done();
190+
});
191+
});
192+
});
193+
194+
//=================DISK=============================
195+
196+
describe('getDisk Endpoint', () => {
197+
it('should return question and dictionary with variants of anwer for Belbin test', (done) => {
198+
request(app.callback())
199+
.get('/api/getDisk')
200+
.set('Authorization', token)
201+
.expect(200)
202+
.end((err, res) => {
203+
if (err) done(err);
204+
205+
expect(res.statusCode).toEqual(200);
206+
expect(res.body.every(cur => {
207+
return (difference(Object.keys(cur), ['name', 'tasks']).length === 0);
208+
})).toBe(true);
209+
expect(res.body.every(cur => {
210+
return isString(cur.name);
211+
})).toBe(true);
212+
expect(res.body.every(cur => {
213+
return cur.tasks.every(elem => {
214+
return isString(elem);
215+
});
216+
})).toBe(true);
217+
218+
done();
219+
});
220+
});
221+
});
222+
223+
describe('diskResults Endpoint', () => {
224+
it('should return array of dictionaries with information about types', (done) => {
225+
request(app.callback())
226+
.get('/api/diskResults')
227+
.set('Authorization', token)
228+
.expect(200)
229+
.end((err, res) => {
230+
if (err) done(err);
231+
232+
expect(res.statusCode).toEqual(200);
233+
expect(res.body.every(cur => {
234+
return Object.values(cur).every(val => !isObject(val));
235+
})).toBe(true);
236+
// expect(res.body.every(cur => {
237+
// return (difference(Object.keys(cur), ['id', 'name', 'image', 'text', 'result']).length === 0);
238+
// })).toBe(true);
135239

136240
done();
137241
});

assets/belbin-icon.png

56.3 KB
Loading

assets/disk-icon.png

28.7 KB
Loading

assets/golland-icon.png

63 KB
Loading

assets/klimov-icon.png

49.6 KB
Loading

ci/dev/config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@ services:
88
- base_url=http://127.0.0.1:3000
99
- browser_base_url=https://dev.panel.profimap.ru
1010
- yandex_metrika=56011483
11+
- sentry_dsn=${SENTRY_DSN}
1112
restart: always
1213
environment:
1314
- HOST=127.0.0.1
1415
- PORT=3000
16+
- LOG_LEVEL=info
17+
- SLACK_WEBHOOK=${SLACK_WEBHOOK}
1518
- DB_HOST=${DB_HOST}
1619
- DB_PORT=${DB_PORT}
1720
- DB_USER=${DB_USER}

ci/prod/config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@ services:
88
- base_url=http://127.0.0.1:3001
99
- browser_base_url=https://panel.profimap.ru
1010
- yandex_metrika=56011483
11+
- sentry_dsn=${SENTRY_DSN}
1112
restart: always
1213
environment:
1314
- HOST=127.0.0.1
1415
- PORT=3001
16+
- LOG_LEVEL=info
17+
- SLACK_WEBHOOK=${SLACK_WEBHOOK}
1518
- DB_HOST=${DB_HOST}
1619
- DB_PORT=${DB_PORT}
1720
- DB_USER=${DB_USER}

components/CharacterType.vue

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
<template>
2+
<v-card
3+
v-if="loaded"
4+
class="elevation-0 results mt-2"
5+
:class="{'pb-2': hasDiskResult}"
6+
tile
7+
>
8+
<v-card-title class="title pb-2">
9+
Склад характера
10+
</v-card-title>
11+
<template v-if="!hasDiskResult">
12+
<v-list-item
13+
v-for="type in diskTypesResult"
14+
:key="type.id"
15+
class="pl-7 pr-7"
16+
>
17+
<v-list-item-avatar tile>
18+
<v-img :src="type.image" />
19+
</v-list-item-avatar>
20+
<v-list-item-content>
21+
<v-list-item-title class="type">
22+
{{ `Тип ${type.name}` }}
23+
</v-list-item-title>
24+
<v-list-item-subtitle class="type-text">
25+
{{ type.text }}
26+
</v-list-item-subtitle>
27+
</v-list-item-content>
28+
</v-list-item>
29+
<div class="my-3 text-center">
30+
<nuxt-link to="/tests/disk" class="link">
31+
<h4 class="subtitle-1">
32+
Узнать свой склад характера
33+
<v-icon small>
34+
mdi-open-in-new
35+
</v-icon>
36+
</h4>
37+
</nuxt-link>
38+
</div>
39+
</template>
40+
<v-list-item
41+
v-else
42+
class="pl-7 pr-7"
43+
>
44+
<v-list-item-avatar tile>
45+
<v-img :src="diskTypesResult[0].image" />
46+
</v-list-item-avatar>
47+
<v-list-item-content>
48+
<v-list-item-title class="type">
49+
{{ `Тип ${diskTypesResult[0].name}` }}
50+
<template>
51+
— {{ `${Math.round(diskTypesResult[0].result * 100)}%` }}
52+
</template>
53+
</v-list-item-title>
54+
<v-list-item-subtitle class="type-text">
55+
{{ diskTypesResult[0].text }}
56+
</v-list-item-subtitle>
57+
</v-list-item-content>
58+
</v-list-item>
59+
</v-card>
60+
</template>
61+
62+
<script>
63+
export default {
64+
data() {
65+
return {
66+
loaded: false,
67+
hasDiskResult: false,
68+
diskTypesResult: [],
69+
};
70+
},
71+
created() {
72+
this.$axios.$get('diskResults').then(response => {
73+
this.loaded = true;
74+
this.hasDiskResult = (response || []).some(t => t.result);
75+
this.diskTypesResult = (response || []).sort((a, b) => b.result - a.result);
76+
77+
if (this.hasDiskResult) {
78+
this.$store.commit('updateProfileProgress', 'disk');
79+
}
80+
});
81+
},
82+
};
83+
</script>
84+
85+
<style lang="scss" scoped>
86+
.link {
87+
text-decoration: none;
88+
}
89+
90+
.subtitle-1 {
91+
color: #1782FF;
92+
line-height: 1.3rem;
93+
}
94+
95+
.results {
96+
border: 1px solid #E5E5E5;
97+
border-radius: 5px;
98+
}
99+
100+
.type-text {
101+
overflow: hidden;
102+
margin-top: 6px;
103+
font-style: normal;
104+
font-weight: normal;
105+
font-size: 14px;
106+
line-height: 16px;
107+
color: rgba(0, 0, 0, 0.6);
108+
text-align: justify;
109+
white-space: normal;
110+
111+
&.description {
112+
white-space: nowrap;
113+
height: auto;
114+
max-height: 16px;
115+
transition: max-height 2.5s ease-out;
116+
117+
&.expand {
118+
max-height: 400px;
119+
white-space: normal;
120+
}
121+
}
122+
}
123+
</style>

components/Charts/Learning.vue

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@
88
</v-card-title>
99
<Preloader v-if="!myChart && !noData" :width="loaderSize" :height="loaderSize" />
1010
<canvas ref="canvas" height="250" class="px-4" />
11-
<div v-if="!myChart && noData" class="no-data text-center">
12-
<h3 class="headline">
13-
Для Вас нет статистики :(
14-
</h3>
11+
<div v-if="myChart && noData" class="my-3 text-center">
1512
<nuxt-link to="/tests/golland" class="link">
16-
<h4 class="subtitle-1 mt-2">
17-
Пройдите тест Голланда,
18-
чтобы наша система смогла узнать вас получше
13+
<h4 class="subtitle-1">
14+
Узнать свои скиллы
15+
<v-icon small>
16+
mdi-open-in-new
17+
</v-icon>
1918
</h4>
2019
</nuxt-link>
2120
</div>
@@ -25,7 +24,6 @@
2524
<script>
2625
import Chart from 'chart.js';
2726
import hexToRgba from 'hex-to-rgba';
28-
import { isEmpty } from 'lodash';
2927
3028
import Preloader from '../Preloader';
3129
@@ -60,6 +58,9 @@
6058
tooltips: {
6159
enabled: true,
6260
callbacks: { // https://github.com/chartjs/Chart.js/issues/6188#issuecomment-497251833
61+
title: (tooltipItems, data) => {
62+
return data.labels[tooltipItems[0].index];
63+
},
6364
label: (tooltipItem, data) => {
6465
return 'Уровень : ' + data.datasets[tooltipItem.datasetIndex].data[tooltipItem.index] + '%';
6566
}
@@ -74,7 +75,7 @@
7475
return hexToRgba(this.$vuetify.theme.themes.light.primary, 0.2);
7576
},
7677
loaderSize() {
77-
return this.$vuetify.breakpoint.smAndDown ? 150 : 200;
78+
return this.$vuetify.breakpoint.smAndDown ? 160 : 250;
7879
},
7980
},
8081
mounted() {
@@ -85,11 +86,10 @@
8586
const ctx = this.$refs.canvas;
8687
const result = await this.$axios.$get('gollandResults');
8788
88-
if (isEmpty(result)) {
89-
this.noData = true;
90-
ctx.classList.add('d-none');
89+
this.noData = !Object.values(result).every(Boolean);
9190
92-
return;
91+
if (!this.noData) {
92+
this.$store.commit('updateProfileProgress', 'golland');
9393
}
9494
9595
const config = {
@@ -115,9 +115,6 @@
115115
border: 1px solid #E5E5E5;
116116
border-radius: 5px;
117117
}
118-
.no-data {
119-
margin: 50px 0;
120-
}
121118
.link {
122119
text-decoration: none;
123120
}

0 commit comments

Comments
 (0)