-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
214 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
@import 'src/styles/variables'; | ||
|
||
.billboard { | ||
display: block; | ||
width: 100%; | ||
padding: 0; | ||
margin: 0 auto -44px; | ||
text-align: center; | ||
|
||
background-repeat: repeat-x; | ||
background-size: auto 100%; | ||
background-position: bottom left; | ||
|
||
&_box { | ||
position: relative; | ||
|
||
display: inline-block; | ||
width: 400px; | ||
height: 160px; | ||
margin: 0 auto; | ||
|
||
background-repeat: no-repeat; | ||
background-size: 100% auto; | ||
background-position: top left; | ||
} | ||
|
||
&_title { | ||
font-family: monospace; | ||
font-size: 22px; | ||
font-weight: 100; | ||
|
||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 92px; | ||
padding: var(--space-m); | ||
margin: 0 auto; | ||
|
||
line-height: 1.3; | ||
text-align: center; | ||
box-sizing: border-box; | ||
text-shadow: 1px 1px 1px #FEFEFE; | ||
color: #4E3C3B; | ||
} | ||
|
||
&_cloud { | ||
padding-top: 50px; | ||
background-color: #F0AE7A; | ||
background-size: auto 56%; | ||
} | ||
|
||
&_green { | ||
padding-top: 12px; | ||
background-color: #557D4B; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import React from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import style from './index.module.scss'; | ||
|
||
interface BillBoardProps { | ||
title: string; | ||
type: string; | ||
} | ||
|
||
function BillBoard({ | ||
title, | ||
type, | ||
}: BillBoardProps): React.ReactElement | null { | ||
const { t } = useTranslation(); | ||
if (!title) return null; | ||
|
||
const className = type === 'cloud' | ||
? style.billboard_cloud | ||
: style.billboard_green; | ||
|
||
const icon = type === 'cloud' | ||
? './assets/games/cloud.png' | ||
: './assets/games/lawn.png'; | ||
|
||
return ( | ||
<div | ||
className={`${style.billboard} ${className}`} | ||
style={{ | ||
backgroundImage: `url(${icon})`, | ||
}} | ||
> | ||
<div | ||
className={style.billboard_box} | ||
style={{ | ||
backgroundImage: 'url(./assets/games/billboard1.png)', | ||
}} | ||
> | ||
<div className={style.billboard_title}> | ||
{t(title || '')} | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
|
||
export default BillBoard; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export default function getQuestion( | ||
question: string, | ||
answers: string[], | ||
rightAnswer: number, | ||
) { | ||
return { | ||
title: question, | ||
index: 0, | ||
answers: answers.map((title: string, index: number) => ({ | ||
title, | ||
score: rightAnswer === index ? 1 : 0, | ||
})), | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
import dataGripStore from 'ts/store/DataGrip'; | ||
import { getRandom, shuffle } from 'ts/helpers/random'; | ||
|
||
import IQuiz from '../interfaces/Quiz'; | ||
import getQuestion from './getQuestion'; | ||
|
||
function getQuestionByList( | ||
authors: any[], | ||
question: string, | ||
getValue: Function, | ||
rightIndex?: number, | ||
) { | ||
const answers = authors | ||
.sort((a, b) => getValue(b) - getValue(a)) | ||
.slice(0, 3) | ||
.map((data) => data.author); | ||
const rightAnswer = answers[rightIndex || 0]; | ||
const formattedAnswers = shuffle(answers); | ||
return getQuestion(question, formattedAnswers, formattedAnswers.indexOf(rightAnswer)); | ||
} | ||
|
||
function getQuestionByNumber(question: string, rightAnswer: number) { | ||
let a, b; | ||
if (rightAnswer < 3) { | ||
a = rightAnswer + 1; | ||
b = rightAnswer + 2; | ||
} else { | ||
a = rightAnswer + (getRandom(rightAnswer) * (Math.random() > 0.5 ? 1 : -1)); | ||
b = rightAnswer + (getRandom(rightAnswer) * (Math.random() > 0.5 ? 1 : -1)); | ||
if (a === b) return null; | ||
} | ||
const answers = shuffle([rightAnswer, a, b]); | ||
return getQuestion(question, answers, answers.indexOf(rightAnswer)); | ||
} | ||
|
||
function getHowTaskInDay(user: any) { | ||
if (!user) return null; | ||
const question = `Сколько максимум задач в день делал ${user.author}?`; | ||
const byTimestamp = dataGripStore.dataGrip.timestamp.statisticByAuthor[user.author]; | ||
const rightAnswer = byTimestamp.tasksByTimestampCounter.max; | ||
return getQuestionByNumber(question, rightAnswer); | ||
} | ||
|
||
export default function getQuizQuestions(): IQuiz { | ||
const authorsWithStaff = [...dataGripStore.dataGrip.author.statistic]; | ||
const authors = authorsWithStaff.filter((data) => !data.isStaff); | ||
const dismissed = dataGripStore.dataGrip.author.employment.dismissed.length; | ||
const staff = dataGripStore.dataGrip.author.employment.staff.length; | ||
// const types = shuffle(dataGripStore.dataGrip.type.list.slice(2)).slice(0, 3); | ||
const randomUsers = shuffle([...authors]).slice(0, 3); | ||
|
||
// сколько в среднем работают на проекте | ||
// во сколько чаще всего комитят | ||
// Кто устроился на работу в __Янаваре | ||
// Кто первый стал коммитить ночью | ||
// Задач какого типа больше | ||
|
||
const questions = [ | ||
getQuestionByList(authorsWithStaff, 'Кто сделал первый коммит?', (s: any) => s.firstCommit.milliseconds), | ||
getQuestionByList(authors, 'Кто закрыл больше задач?', (s: any) => s.tasks.length), | ||
getQuestionByList(authors, 'Кто быстрее всех делает задачи?', (s: any) => s.taskInDay), | ||
getQuestionByList(authors, 'Кто дольше всех работал на проекте?', (s: any) => s.daysAll), | ||
getQuestionByList(authors, 'Кто меньше всех работал на проекте?', (s: any) => s.daysAll, 2), | ||
getQuestionByList(authors, 'Кто чаще коммитит?', (s: any) => s.commits / s.daysWorked), | ||
getQuestionByList(authors, 'Кто реже коммитит?', (s: any) => s.commits / s.daysWorked, 2), | ||
getQuestionByList(authors, 'У кого саммые длинные подписи коммитов?', (s: any) => s.middleMessageLength), | ||
getQuestionByList(authors, 'У кого саммые короткие подписи коммитов?', (s: any) => s.middleMessageLength, 2), | ||
getQuestionByList(authors, 'У кого больше всего дней без коммитов?', (s: any) => s.daysLosses / s.daysWorked, 2), | ||
getQuestionByNumber('Сколько человек уволилось?', dismissed), | ||
getQuestionByNumber('Сколько человек помогало проекту?', staff), | ||
getHowTaskInDay(randomUsers[0]), | ||
getHowTaskInDay(randomUsers[1]), | ||
getHowTaskInDay(randomUsers[2]), | ||
] | ||
.filter((question) => question) | ||
.map((question, i: number) => ({ ...question, index: i + 1 })); | ||
|
||
return { | ||
title: '', | ||
description: 'Насколько хорошо ты знаешь команду?', | ||
questions: shuffle(questions), | ||
results: [ | ||
{ | ||
title: 'Поздравляем, пытка окончена', | ||
description: 'Вы протестировали этот квиз и готовы написать на него отзыв длинной два или три предложения.', | ||
min: 0, | ||
max: 60, | ||
}, | ||
], | ||
}; | ||
} |