Skip to content

Commit

Permalink
現地問題のチャレンジボタンの表示をわかりやすくした
Browse files Browse the repository at this point in the history
  • Loading branch information
proelbtn committed Jan 16, 2025
1 parent 812cb25 commit e380e1d
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 27 deletions.
1 change: 1 addition & 0 deletions api/app/graphql/types/contest_info_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ class ContestInfoType < Types::BaseObject
field :realtime_grading, Boolean, null: false
field :guide_page, String, null: false
field :guide_page_en, String, null: false
field :local_problem_codes, String, null: false
end
end
75 changes: 48 additions & 27 deletions ui/components/problems/id/ProblemEnvironmentOperation.vue
Original file line number Diff line number Diff line change
@@ -1,35 +1,47 @@
<template>
<div>
<!-- VM作成・削除ボタン -->
<v-btn
contained
color="success"
@click="acquireProblemEnvironmentVM(problem.id)"
v-if="isSolve"
width="100%"
>
この問題にチャレンジする (接続情報を取得します)
</v-btn>
<v-btn
contained
color="error"
@click="abandonProblemEnvironmentVM(problem.id)"
v-if="isRetire"
width="100%"
>
この問題を諦める (ペナルティはありません / 再チャレンジもできます)
</v-btn>
<v-btn
contained
disabled
v-if="isLock"
width="100%"
>
ロック中 (採点待ち、もしくは他の問題にチャレンジ中です)
</v-btn>
<div v-if="!isLocalProblem">
<!-- VM作成・削除ボタン -->
<v-btn
contained
color="success"
@click="acquireProblemEnvironmentVM(problem.id)"
v-if="isSolve"
width="100%"
>
この問題にチャレンジする (接続情報を取得します)
</v-btn>
<v-btn
contained
color="error"
@click="abandonProblemEnvironmentVM(problem.id)"
v-if="isRetire"
width="100%"
>
この問題を諦める (ペナルティはありません / 再チャレンジもできます)
</v-btn>
<v-btn
contained
disabled
v-if="isLock"
width="100%"
>
ロック中 (採点待ち、もしくは他の問題にチャレンジ中です)
</v-btn>
</div>
<div v-else>
<v-btn
contained
disabled
width="100%"
>
この問題は現地問題です。現地にてチャレンジしてください。
</v-btn>
</div>
</div>
</template>
<script>
import { mapGetters } from 'vuex'
import EnvironmentModal from '~/components/misc/EnvironmentModal'
import ExpandableButton from '~/components/commons/ExpandableButton'
import PlusButton from '~/components/commons/PlusButton'
Expand Down Expand Up @@ -60,6 +72,15 @@ export default {
}
},
computed: {
...mapGetters('contestInfo', ['localProblemCodes']),
isLocalProblem() {
for (const code of this.localProblemCodes.split(",")) {
if (this.problem.code === code) {
return true
}
}
return false
},
//「棄権ボタン」を表示するかどうか
isRetire() {
//採点中・削除中は表示しない
Expand Down
3 changes: 3 additions & 0 deletions ui/store/contestInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export default {
gradingDelaySec: 0,
guidePage: '',
guidePageEn: '',
localProblemCodes: '',
hideAllScore: false,
realtimeGrading: false,
resetDelaySec: 0,
Expand All @@ -19,6 +20,7 @@ export default {
state.gradingDelaySec = contestInfo.gradingDelaySec
state.guidePage = contestInfo.guidePage
state.guidePageEn = contestInfo.guidePageEn
state.localProblemCodes = contestInfo.localProblemCodes
state.hideAllScore = contestInfo.hideAllScore
state.realtimeGrading = contestInfo.realtimeGrading
state.resetDelaySec = contestInfo.resetDelaySec
Expand Down Expand Up @@ -48,6 +50,7 @@ export default {
gradingDelaySec: (state) => state.gradingDelaySec,
guidePage: (state) => state.guidePage,
guidePageEn: (state) => state.guidePageEn,
localProblemCodes: (state) => state.localProblemCodes,
hideAllScore: (state) => state.hideAllScore,
realtimeGrading: (state) => state.realtimeGrading,
resetDelaySec: (state) => state.resetDelaySec,
Expand Down

0 comments on commit e380e1d

Please sign in to comment.