File tree Expand file tree Collapse file tree 3 files changed +15
-11
lines changed
atcoder-problems-frontend/src
pages/Internal/VirtualContest/ShowContest Expand file tree Collapse file tree 3 files changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -323,8 +323,15 @@ export const useVirtualContestSubmissions = (
323
323
return submissionChunks . flatMap ( ( x ) => x ) ;
324
324
} ;
325
325
326
+ const custom_key =
327
+ "useVirtualContestSubmissions&" +
328
+ ( users . length === 0
329
+ ? "empty"
330
+ : users . length === 1
331
+ ? users [ 0 ]
332
+ : "multiuser" ) ;
326
333
return useSWRData (
327
- "useVirtualContestSubmissions" ,
334
+ custom_key ,
328
335
( ) => ( users . length > 0 ? fetcher ( ) : Promise . resolve ( [ ] ) ) ,
329
336
{
330
337
refreshInterval,
Original file line number Diff line number Diff line change @@ -154,11 +154,11 @@ export const ContestTable = (props: Props) => {
154
154
end ,
155
155
props . enableAutoRefresh
156
156
) ;
157
- if ( ! submissions . data && ! submissions . error ) {
158
- return < Spinner / >;
157
+ if ( submissions . error ) {
158
+ return < Alert color = "danger" > Failed to fetch submissions. </ Alert > ;
159
159
}
160
160
if ( ! submissions . data ) {
161
- return < Alert color = "danger" > Failed to fetch submissions. </ Alert > ;
161
+ return < Spinner / >;
162
162
}
163
163
164
164
const modelArray = consolidateModels ( problems , problemMap , problemModels ) ;
Original file line number Diff line number Diff line change @@ -68,25 +68,22 @@ const Problems = (props: {
68
68
} ) => {
69
69
const { alreadyJoined } = props ;
70
70
const submissions = useVirtualContestSubmissions (
71
- [ props . atCoderUserId ] ,
71
+ alreadyJoined ? [ props . atCoderUserId ] : [ ] ,
72
72
props . problems . map ( ( p ) => p . item . id ) ,
73
73
props . start ,
74
74
props . end ,
75
75
false
76
76
) ;
77
77
const pointOverrideMap = constructPointOverrideMap ( props . problems ) ;
78
- const showUserResults =
79
- props . atCoderUserId !== "" &&
80
- submissions . data !== null &&
81
- submissions . data !== undefined ;
78
+ const showUserResults = alreadyJoined && submissions . data ;
82
79
const results = submissions . data
83
80
? reduceUserContestResult ( submissions . data , ( id ) =>
84
81
pointOverrideMap . get ( id )
85
82
)
86
83
: new Map < UserId , ReducedProblemResult > ( ) ;
87
84
const ResultIcon = ( props : { id : ProblemId } ) => {
88
85
const result = results . get ( props . id ) ;
89
- if ( ! alreadyJoined || ! result ) return null ;
86
+ if ( ! result ) return null ;
90
87
if ( result . accepted ) {
91
88
return < FcCheckmark /> ;
92
89
} else {
@@ -210,7 +207,7 @@ const Standings = (props: StandingsProps) => {
210
207
checked = { showRating }
211
208
onChange = { ( ) : void => setShowRating ( ! showRating ) }
212
209
/>
213
- { alreadyJoined && (
210
+ { alreadyJoined && contestInfo . mode === null && (
214
211
< CustomInput
215
212
type = "switch"
216
213
id = "pinMe"
You can’t perform that action at this time.
0 commit comments