Skip to content

Commit

Permalink
Servo show judge name if available
Browse files Browse the repository at this point in the history
  • Loading branch information
swantzter committed Nov 2, 2024
1 parent 909892d commit aedd607
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/components/ScoreNavigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

<div class="overflow-hidden text-center">
<template v-if="isServoIntermediateScoresheet(scsh.scoresheet.value)">
<span class="font-bold">{{ scsh.scoresheet.value?.judgeType }}</span>{{ scsh.scoresheet.value.judge.id }}
<span class="font-bold">{{ scsh.scoresheet.value?.judgeType }}</span>{{ scsh.scoresheet.value.judge.id }}:
{{ scsh.scoresheet.value?.judge.name }}
</template>
<template v-else-if="isRemoteMarkScoresheet(scsh.scoresheet.value)">
<span class="font-bold">{{ scsh.scoresheet.value.judgeType }}</span>: {{ scsh.scoresheet.value.judge.name }}
Expand Down Expand Up @@ -83,7 +84,7 @@
<script lang="ts" setup>
import { computed, ref, type PropType } from 'vue'
import { useRouter } from 'vue-router'
import { useScoresheet, isUndoMark, isServoIntermediateScoresheet, isRemoteMarkScoresheet, isRemoteTallyScoresheet } from '../hooks/scoresheet'
import { useScoresheet, isUndoMark, isServoIntermediateScoresheet, isRemoteMarkScoresheet } from '../hooks/scoresheet'
import { useConfirm } from '../hooks/confirm'
import ScoreButton from './ScoreButton.vue'
import { version } from '../helpers'
Expand Down
3 changes: 3 additions & 0 deletions src/components/ServoEntryLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ async function createScoresheet () {
heat: entry.value.HeatNumber,
station: props.stationName.replace(/[^\d]/g, '')
},
judge: {
name: judge.value.AssignedJudge != null ? `${judge.value.AssignedJudge.FirstName ?? ''} ${judge.value.AssignedJudge.LastName ?? ''}`.trim() : undefined
}
})
openScoresheet(scoresheetId)
} finally {
Expand Down
15 changes: 13 additions & 2 deletions src/hooks/scoresheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export interface ServoIntermediateScoresheet<T extends string> {
}
judge: {
id: number
name?: string
}

marks: Array<Mark<T>>
Expand Down Expand Up @@ -142,6 +143,14 @@ export interface ServoSession {
export interface ServoJudge {
JudgeSequence: number
JudgeType: string
JudgeName: string
AssignedJudge: ServoAssignedJudge | null
}

export interface ServoAssignedJudge {
ParticipantID: number
FirstName: string
LastName: string
}

export interface ServoCompetition {
Expand Down Expand Up @@ -674,8 +683,9 @@ export interface CreateServoScoresheetArgs {
competitionEventId: string
options?: Record<string, any> | null
entry: ServoIntermediateScoresheet<string>['entry']
judge: Omit<ServoIntermediateScoresheet<string>['judge'], 'id'>
}
export async function createServoScoresheet ({ competitionId, entryId, judgeSequence, judgeType: _judgeType, scoringModel, competitionEventId, entry, options }: CreateServoScoresheetArgs) {
export async function createServoScoresheet ({ competitionId, entryId, judgeSequence, judgeType: _judgeType, scoringModel, competitionEventId, entry, judge, options }: CreateServoScoresheetArgs) {
try {
let judgeType = _judgeType
if (judgeType == null) {
Expand Down Expand Up @@ -742,7 +752,8 @@ export async function createServoScoresheet ({ competitionId, entryId, judgeSequ
rulesId: scoringModel,
entry,
judge: {
id: judgeSequence
id: judgeSequence,
...judge,
},
judgeType,
competitionEventId,
Expand Down

0 comments on commit aedd607

Please sign in to comment.