File tree Expand file tree Collapse file tree 3 files changed +46
-0
lines changed
pages/academy/groundControl Expand file tree Collapse file tree 3 files changed +46
-0
lines changed Original file line number Diff line number Diff line change @@ -1273,6 +1273,24 @@ export const calculateContestScore = async (
1273
1273
return resp ;
1274
1274
} ;
1275
1275
1276
+ /**
1277
+ * POST /courses/{courseId}/admin/assessments/{assessmentId}/dispatchContestXp
1278
+ */
1279
+ export const dispatchContestXp = async (
1280
+ assessmentId : number ,
1281
+ tokens : Tokens
1282
+ ) : Promise < Response | null > => {
1283
+ const resp = await request (
1284
+ `${ courseId ( ) } /admin/assessments/${ assessmentId } /dispatchContestXp` ,
1285
+ 'POST' ,
1286
+ {
1287
+ ...tokens
1288
+ }
1289
+ ) ;
1290
+
1291
+ return resp ;
1292
+ } ;
1293
+
1276
1294
/**
1277
1295
* GET /courses/{courseId}/admin/assessments/{assessmentId}/{visibleEntries}/scoreLeaderboard
1278
1296
*/
Original file line number Diff line number Diff line change
1
+ import { IconNames } from '@blueprintjs/icons' ;
2
+ import ControlButton from 'src/commons/ControlButton' ;
3
+ import { dispatchContestXp } from 'src/commons/sagas/RequestsSaga' ;
4
+ import { useTokens } from 'src/commons/utils/Hooks' ;
5
+
6
+ type Props = {
7
+ assessmentId : number ;
8
+ } ;
9
+
10
+ const CalculateContestScoreButton : React . FC < Props > = ( { assessmentId } ) => {
11
+ const tokens = useTokens ( ) ;
12
+
13
+ return (
14
+ < div className = "control-button-container" >
15
+ < ControlButton
16
+ icon = { IconNames . AddRowTop }
17
+ onClick = { async ( ) => {
18
+ dispatchContestXp ( assessmentId , tokens ) ;
19
+ } }
20
+ label = "Dispatch Contest XP"
21
+ />
22
+ </ div >
23
+ ) ;
24
+ } ;
25
+
26
+ export default CalculateContestScoreButton ;
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import CalculateContestScoreButton from '../configureControls/CalculateContestSc
18
18
import ExportScoreLeaderboardButton from '../configureControls/ExportScoreLeaderboardButton' ;
19
19
import ExportVoteLeaderboardButton from '../configureControls/ExportVoteLeaderboardButton' ;
20
20
import AssignEntriesButton from './configureControls/AssignEntriesButton' ;
21
+ import DispatchContestXpButton from '../configureControls/DispatchContestXpButton' ;
21
22
22
23
type Props = {
23
24
handleConfigureAssessment : (
@@ -119,6 +120,7 @@ const ConfigureCell: React.FC<Props> = ({
119
120
< Collapse isOpen = { hasVotingFeatures } >
120
121
< div className = "voting-related-controls" >
121
122
< CalculateContestScoreButton assessmentId = { data . id } />
123
+ < DispatchContestXpButton assessmentId = { data . id } />
122
124
< ExportScoreLeaderboardButton assessmentId = { data . id } />
123
125
< ExportVoteLeaderboardButton assessmentId = { data . id } />
124
126
< AssignEntriesButton
You can’t perform that action at this time.
0 commit comments