refactor [OVT-62]: фикс победителей

This commit is contained in:
denzel committed 2026-10-21 09:05:20 -04:00
commit 297d2a71bf
10 files changed
+18557 -18

No files matched your search

Generated Executable
+10
View File
@@ -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
Generated Executable
+8
View File
@@ -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>
Generated Executable
+59
View File
@@ -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
View File
@@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>
+6
View File
@@ -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>
Generated Executable
+8
View File
@@ -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>
Generated Executable
+7
View File
@@ -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>
+18432
View File
File diff suppressed because it is too large. Load diff
+21 -17
View File
@@ -43,10 +43,10 @@
<strong class="text-teal-darken-4" style="max-width: 800px; white-space: normal; word-wrap: break-word;">{{ department }}</strong> <strong class="text-teal-darken-4" style="max-width: 800px; white-space: normal; word-wrap: break-word;">{{ department }}</strong>
</v-card-title> </v-card-title>
<v-card-subtitle> <v-card-subtitle>
Победитель: {{ winner.employee.fio || winner.name }} 🏆 Победитель: {{ getWinnerNames(winner) }} 🏆
</v-card-subtitle> </v-card-subtitle>
<v-card-text> <v-card-text>
Количество голосов: {{ winner.count }} Количество голосов: {{ winner[0]?.count || 0 }}
</v-card-text> </v-card-text>
</v-card> </v-card>
</v-col> </v-col>
@@ -57,10 +57,10 @@
<h3 class="text-center">{{ question.name }}</h3> <h3 class="text-center">{{ question.name }}</h3>
<v-card-title class="d-flex ga-2 align-center"> <v-card-title class="d-flex ga-2 align-center">
<h4 class="text-teal-darken-4">Победитель:</h4> <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-title>
<v-card-subtitle> <v-card-subtitle>
Количество голосов: {{ getWinner(question)?.count || 0 }} Количество голосов: {{ getWinners(question)[0]?.count || 0 }}
</v-card-subtitle> </v-card-subtitle>
</v-col> </v-col>
<v-col cols="12"> <v-col cols="12">
@@ -263,11 +263,19 @@ export default {
dialogWinner.value = true; dialogWinner.value = true;
}; };
const getWinner = (question) => { const getWinners = (question) => {
return question.answers.reduce( const answers = question.answers || [];
(max, answer) => (answer.count > max.count ? answer : max), const maxCount = answers.reduce((max, answer) => Math.max(max, answer.count), 0);
{ count: 0, employee: { fio: '', department: '', post: '' }, name: '' },
); 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) => { const getTopResults = (question) => {
@@ -366,15 +374,10 @@ export default {
return groups; return groups;
}, {}); }, {});
// Для каждого департамента находим победителя // Для каждого департамента находим всех лидеров
const winnersByDepartment = {}; const winnersByDepartment = {};
for (const department in groupedByDepartment) { for (const department in groupedByDepartment) {
const answers = groupedByDepartment[department]; winnersByDepartment[department] = getWinners({ 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;
} }
return { groupedByDepartment, winnersByDepartment }; return { groupedByDepartment, winnersByDepartment };
@@ -393,7 +396,8 @@ export default {
dialog, dialog,
activeTab, activeTab,
questions, questions,
getWinner, getWinners,
getWinnerNames,
getTopResults, getTopResults,
truncateText, truncateText,
shouldShowTooltip, shouldShowTooltip,
+1 -1
View File
@@ -1,6 +1,6 @@
import '@mdi/font/css/materialdesignicons.css' import '@mdi/font/css/materialdesignicons.css'
import 'vuetify/styles' import 'vuetify/styles'
import { VCalendar } from 'vuetify/labs/VCalendar' import { VCalendar } from 'vuetify/components/VCalendar'
import { createVuetify } from 'vuetify' import { createVuetify } from 'vuetify'
import { ru } from 'vuetify/locale' import { ru } from 'vuetify/locale'