refactor [OVT-62]: фикс победителей
This commit is contained in:
1 parent
c8561a1749
commit
3ae3cff498
9 files changed
+18556
-17
No files matched your search
+10
@@ -0,0 +1,10 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Ignored default folder with query files
|
||||
/queries/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<HTMLCodeStyleSettings>
|
||||
<option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
|
||||
</HTMLCodeStyleSettings>
|
||||
<JSCodeStyleSettings version="0">
|
||||
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
||||
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
||||
<option name="USE_DOUBLE_QUOTES" value="false" />
|
||||
<option name="FORCE_QUOTE_STYlE" value="true" />
|
||||
<option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
|
||||
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
||||
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
||||
</JSCodeStyleSettings>
|
||||
<TypeScriptCodeStyleSettings version="0">
|
||||
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
||||
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
||||
<option name="USE_DOUBLE_QUOTES" value="false" />
|
||||
<option name="FORCE_QUOTE_STYlE" value="true" />
|
||||
<option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
|
||||
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
||||
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
||||
</TypeScriptCodeStyleSettings>
|
||||
<VueCodeStyleSettings>
|
||||
<option name="INTERPOLATION_NEW_LINE_AFTER_START_DELIMITER" value="false" />
|
||||
<option name="INTERPOLATION_NEW_LINE_BEFORE_END_DELIMITER" value="false" />
|
||||
</VueCodeStyleSettings>
|
||||
<codeStyleSettings language="HTML">
|
||||
<option name="SOFT_MARGINS" value="100" />
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||
<option name="TAB_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="JavaScript">
|
||||
<option name="SOFT_MARGINS" value="100" />
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||
<option name="TAB_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="TypeScript">
|
||||
<option name="SOFT_MARGINS" value="100" />
|
||||
<indentOptions>
|
||||
<option name="INDENT_SIZE" value="2" />
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||
<option name="TAB_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="Vue">
|
||||
<option name="SOFT_MARGINS" value="100" />
|
||||
<indentOptions>
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
||||
</indentOptions>
|
||||
</codeStyleSettings>
|
||||
</code_scheme>
|
||||
</component>
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||
</state>
|
||||
</component>
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
</profile>
|
||||
</component>
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/PORTAL_COD2.iml" filepath="$PROJECT_DIR$/.idea/PORTAL_COD2.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
Generated
+18432
File diff suppressed because it is too large.
Load diff
@@ -43,10 +43,10 @@
|
||||
<strong class="text-teal-darken-4" style="max-width: 800px; white-space: normal; word-wrap: break-word;">{{ department }}</strong>
|
||||
</v-card-title>
|
||||
<v-card-subtitle>
|
||||
Победитель: {{ winner.employee.fio || winner.name }} 🏆
|
||||
Победитель: {{ getWinnerNames(winner) }} 🏆
|
||||
</v-card-subtitle>
|
||||
<v-card-text>
|
||||
Количество голосов: {{ winner.count }}
|
||||
Количество голосов: {{ winner[0]?.count || 0 }}
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-col>
|
||||
@@ -57,10 +57,10 @@
|
||||
<h3 class="text-center">{{ question.name }}</h3>
|
||||
<v-card-title class="d-flex ga-2 align-center">
|
||||
<h4 class="text-teal-darken-4">Победитель:</h4>
|
||||
<h3>{{ getWinner(question).employee?.fio || getWinner(question).name }} 🏆</h3>
|
||||
<h3>{{ getWinnerNames(getWinners(question)) }} 🏆</h3>
|
||||
</v-card-title>
|
||||
<v-card-subtitle>
|
||||
Количество голосов: {{ getWinner(question)?.count || 0 }}
|
||||
Количество голосов: {{ getWinners(question)[0]?.count || 0 }}
|
||||
</v-card-subtitle>
|
||||
</v-col>
|
||||
<v-col cols="12">
|
||||
@@ -263,11 +263,19 @@ export default {
|
||||
dialogWinner.value = true;
|
||||
};
|
||||
|
||||
const getWinner = (question) => {
|
||||
return question.answers.reduce(
|
||||
(max, answer) => (answer.count > max.count ? answer : max),
|
||||
{ count: 0, employee: { fio: '', department: '', post: '' }, name: '' },
|
||||
);
|
||||
const getWinners = (question) => {
|
||||
const answers = question.answers || [];
|
||||
const maxCount = answers.reduce((max, answer) => Math.max(max, answer.count), 0);
|
||||
|
||||
if (maxCount === 0) {
|
||||
return [{ count: 0, employee: { fio: '', department: '', post: '' }, name: '' }];
|
||||
}
|
||||
|
||||
return answers.filter(answer => answer.count === maxCount);
|
||||
};
|
||||
|
||||
const getWinnerNames = (winners) => {
|
||||
return winners.map(answer => answer.employee?.fio || answer.name).join(' / ');
|
||||
};
|
||||
|
||||
const getTopResults = (question) => {
|
||||
@@ -366,15 +374,10 @@ export default {
|
||||
return groups;
|
||||
}, {});
|
||||
|
||||
// Для каждого департамента находим победителя
|
||||
// Для каждого департамента находим всех лидеров
|
||||
const winnersByDepartment = {};
|
||||
for (const department in groupedByDepartment) {
|
||||
const answers = groupedByDepartment[department];
|
||||
const winner = answers.reduce(
|
||||
(max, answer) => (answer.count > max.count ? answer : max),
|
||||
{ count: 0, employee: { fio: '', department: '', post: '' }, name: '' },
|
||||
);
|
||||
winnersByDepartment[department] = winner;
|
||||
winnersByDepartment[department] = getWinners({ answers: groupedByDepartment[department] });
|
||||
}
|
||||
|
||||
return { groupedByDepartment, winnersByDepartment };
|
||||
@@ -393,7 +396,8 @@ export default {
|
||||
dialog,
|
||||
activeTab,
|
||||
questions,
|
||||
getWinner,
|
||||
getWinners,
|
||||
getWinnerNames,
|
||||
getTopResults,
|
||||
truncateText,
|
||||
shouldShowTooltip,
|
||||
|
||||
Reference in new issue
Block a user