Skip to content

Commit 60eb5e2

Browse files
authored
Revert "Add total XP table" feature (#2780)
* Revert ":sparkles: feat: add total xp table (#2281)" This reverts commit d47cc0e. * Fix revert from conflicting changes * Fix tests post-revert * Update conflicting test files * Update snapshots
1 parent 4f55b88 commit 60eb5e2

File tree

11 files changed

+6
-302
lines changed

11 files changed

+6
-302
lines changed

src/commons/application/ApplicationTypes.ts

-1
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,6 @@ export const defaultSession: SessionState = {
498498
collectibles: {}
499499
},
500500
xp: 0,
501-
allUserXp: undefined,
502501
story: {
503502
story: '',
504503
playStory: false

src/commons/application/actions/SessionActions.ts

-6
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import {
2222
DELETE_TIME_OPTIONS,
2323
DELETE_USER_COURSE_REGISTRATION,
2424
FETCH_ADMIN_PANEL_COURSE_REGISTRATIONS,
25-
FETCH_ALL_USER_XP,
2625
FETCH_ASSESSMENT,
2726
FETCH_ASSESSMENT_ADMIN,
2827
FETCH_ASSESSMENT_CONFIGS,
@@ -65,7 +64,6 @@ import {
6564
TimeOption,
6665
Tokens,
6766
UNSUBMIT_SUBMISSION,
68-
UPDATE_ALL_USER_XP,
6967
UPDATE_ASSESSMENT,
7068
UPDATE_ASSESSMENT_CONFIGS,
7169
UPDATE_ASSESSMENT_OVERVIEWS,
@@ -103,8 +101,6 @@ export const fetchTotalXp = () => action(FETCH_TOTAL_XP);
103101

104102
export const fetchTotalXpAdmin = (courseRegId: number) => action(FETCH_TOTAL_XP_ADMIN, courseRegId);
105103

106-
export const fetchAllUserXp = () => action(FETCH_ALL_USER_XP);
107-
108104
export const fetchGrading = (submissionId: number) => action(FETCH_GRADING, submissionId);
109105

110106
/**
@@ -209,8 +205,6 @@ export const updateAssessmentOverviews = (overviews: AssessmentOverview[]) =>
209205

210206
export const updateTotalXp = (totalXp: number) => action(UPDATE_TOTAL_XP, totalXp);
211207

212-
export const updateAllUserXp = (allUserXp: string[][]) => action(UPDATE_ALL_USER_XP, allUserXp);
213-
214208
export const updateAssessment = (assessment: Assessment) => action(UPDATE_ASSESSMENT, assessment);
215209

216210
export const updateGradingOverviews = (overviews: GradingOverview[]) =>

src/commons/application/reducers/SessionsReducer.ts

-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import {
2222
SET_NOTIFICATION_CONFIGS,
2323
SET_TOKENS,
2424
SET_USER,
25-
UPDATE_ALL_USER_XP,
2625
UPDATE_ASSESSMENT,
2726
UPDATE_ASSESSMENT_OVERVIEWS,
2827
UPDATE_GRADING,
@@ -112,8 +111,6 @@ export const SessionsReducer: Reducer<SessionState> = (
112111
};
113112
case UPDATE_TOTAL_XP:
114113
return { ...state, xp: action.payload };
115-
case UPDATE_ALL_USER_XP:
116-
return { ...state, allUserXp: action.payload };
117114
case UPDATE_GRADING:
118115
const newGradings = new Map(state.gradings);
119116
newGradings.set(action.payload.submissionId, action.payload.grading);

src/commons/application/types/SessionTypes.ts

-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ export const FETCH_COURSE_CONFIG = 'FETCH_COURSE_CONFIG';
1818
export const FETCH_ASSESSMENT = 'FETCH_ASSESSMENT';
1919
export const FETCH_ASSESSMENT_ADMIN = 'FETCH_ASSESSMENT_ADMIN';
2020
export const FETCH_ASSESSMENT_OVERVIEWS = 'FETCH_ASSESSMENT_OVERVIEWS';
21-
export const FETCH_ALL_USER_XP = 'FETCH_ALL_USER_XP';
2221
export const FETCH_TOTAL_XP = 'FETCH_TOTAL_XP';
2322
export const FETCH_TOTAL_XP_ADMIN = 'FETCH_TOTAL_XP_ADMIN';
2423
export const FETCH_GRADING = 'FETCH_GRADING';
@@ -48,7 +47,6 @@ export const REMOVE_GITHUB_OCTOKIT_OBJECT_AND_ACCESS_TOKEN =
4847
export const UNSUBMIT_SUBMISSION = 'UNSUBMIT_SUBMISSION';
4948
export const UPDATE_ASSESSMENT_OVERVIEWS = 'UPDATE_ASSESSMENT_OVERVIEWS';
5049
export const UPDATE_TOTAL_XP = 'UPDATE_TOTAL_XP';
51-
export const UPDATE_ALL_USER_XP = 'UPDATE_ALL_USER_XP';
5250
export const UPDATE_ASSESSMENT = 'UPDATE_ASSESSMENT';
5351
export const UPDATE_GRADING_OVERVIEWS = 'UPDATE_GRADING_OVERVIEWS';
5452
export const UPDATE_GRADING = 'UPDATE_GRADING';
@@ -93,7 +91,6 @@ export type SessionState = {
9391
readonly gameState: GameState;
9492
readonly courseId?: number;
9593
readonly xp: number;
96-
readonly allUserXp: string[][] | undefined;
9794
readonly story: Story;
9895

9996
// Course Configuration

src/commons/navigationBar/subcomponents/AcademyNavigationBar.tsx

-7
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,6 @@ const getStaffNavlinkInfo = ({
120120
disabled: !isStaffOrAdmin,
121121
hiddenInBreakpoints: ['xs', 'sm', 'md']
122122
},
123-
{
124-
to: `/courses/${courseId}/xpcalculation`,
125-
icon: IconNames.CALCULATOR,
126-
text: 'XP Calculation',
127-
disabled: !isAdmin,
128-
hiddenInBreakpoints: ['xs', 'sm', 'md', 'lg']
129-
},
130123
{
131124
to: `/courses/${courseId}/adminpanel`,
132125
icon: IconNames.SETTINGS,

src/commons/navigationBar/subcomponents/__tests__/AcademyNavigationBar.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const useSelectorMock = useSelector as jest.Mock;
1212

1313
const assessmentTypes = ['Missions', 'Quests', 'Paths', 'Contests', 'Others'];
1414
const staffRoutes = ['grading', 'groundcontrol', 'sourcereel', 'storysimulator', 'dashboard'];
15-
const adminRoutes = ['adminpanel', 'xpcalculation'];
15+
const adminRoutes = ['adminpanel'];
1616
const courseId = 0;
1717
const createCoursePath = (path: string) => `/courses/${courseId}/${path}`;
1818

@@ -71,7 +71,7 @@ test('MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard and G
7171
validateAdminPaths(tree, false);
7272
});
7373

74-
test('MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, Grading, XP Calculation and AdminPanel NavLinks render for Role.Admin', () => {
74+
test('MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, Grading and AdminPanel NavLinks render for Role.Admin', () => {
7575
useSelectorMock.mockReturnValueOnce({
7676
role: Role.Admin,
7777
courseId

src/commons/navigationBar/subcomponents/__tests__/__snapshots__/AcademyNavigationBar.tsx.snap

+1-17
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, G
346346
</Blueprint5.Navbar>
347347
`;
348348

349-
exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, Grading, XP Calculation and AdminPanel NavLinks render for Role.Admin 1`] = `
349+
exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, Grading and AdminPanel NavLinks render for Role.Admin 1`] = `
350350
<Blueprint5.Navbar
351351
className="NavigationBar secondary-navbar"
352352
>
@@ -541,22 +541,6 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, G
541541
Game Simulator
542542
</div>
543543
</NavLink>
544-
<NavLink
545-
className={[Function]}
546-
title="XP Calculation"
547-
to="/courses/0/xpcalculation"
548-
>
549-
<Blueprint5.Icon
550-
autoLoad={true}
551-
icon="calculator"
552-
tagName="span"
553-
/>
554-
<div
555-
className="hidden-xs hidden-sm hidden-md hidden-lg"
556-
>
557-
XP Calculation
558-
</div>
559-
</NavLink>
560544
<NavLink
561545
className={[Function]}
562546
title="Admin Panel"

src/commons/sagas/BackendSaga.ts

-11
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ import {
3333
DELETE_TIME_OPTIONS,
3434
DELETE_USER_COURSE_REGISTRATION,
3535
FETCH_ADMIN_PANEL_COURSE_REGISTRATIONS,
36-
FETCH_ALL_USER_XP,
3736
FETCH_ASSESSMENT,
3837
FETCH_ASSESSMENT_ADMIN,
3938
FETCH_ASSESSMENT_CONFIGS,
@@ -87,7 +86,6 @@ import { CHANGE_SUBLANGUAGE, WorkspaceLocation } from '../workspace/WorkspaceTyp
8786
import {
8887
deleteAssessment,
8988
deleteSourcecastEntry,
90-
getAllUserXp,
9189
getAssessment,
9290
getAssessmentConfigs,
9391
getAssessmentOverviews,
@@ -286,15 +284,6 @@ function* BackendSaga(): SagaIterator {
286284
}
287285
});
288286

289-
yield takeEvery(FETCH_ALL_USER_XP, function* () {
290-
const tokens: Tokens = yield selectTokens();
291-
292-
const res: { all_users_xp: string[][] } = yield call(getAllUserXp, tokens);
293-
if (res) {
294-
yield put(actions.updateAllUserXp(res.all_users_xp));
295-
}
296-
});
297-
298287
yield takeEvery(FETCH_TOTAL_XP, function* () {
299288
const tokens: Tokens = yield selectTokens();
300289

src/commons/sagas/RequestsSaga.ts

-14
Original file line numberDiff line numberDiff line change
@@ -454,20 +454,6 @@ export const getTotalXp = async (tokens: Tokens, courseRegId?: number): Promise<
454454
return totalXp;
455455
};
456456

457-
/**
458-
* GET /courses/{courseId}/admin/users/total_xp
459-
*/
460-
export const getAllUserXp = async (tokens: Tokens): Promise<number | null> => {
461-
const resp = await request(`${courseId()}/admin/users/total_xp`, 'GET', {
462-
...tokens
463-
});
464-
if (!resp || !resp.ok) {
465-
return null; // invalid accessToken _and_ refreshToken
466-
}
467-
const totalXp = await resp.json();
468-
return totalXp;
469-
};
470-
471457
/**
472458
* GET /courses/{courseId}/admin/users/{course_reg_id}/assessments
473459
*/

src/pages/academy/Academy.tsx

+3-5
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import GroundControl from './groundControl/GroundControlContainer';
2727
import NotiPreference from './notiPreference/NotiPreference';
2828
import Sourcereel from './sourcereel/Sourcereel';
2929
import StorySimulator from './storySimulator/StorySimulator';
30-
import XpCalculation from './xpCalculation/XpCalculation';
3130

3231
const Academy: React.FC<{}> = () => {
3332
const dispatch = useDispatch();
@@ -42,10 +41,9 @@ const Academy: React.FC<{}> = () => {
4241
? [
4342
<Route path="groundcontrol" element={<GroundControl />} key={0} />,
4443
<Route path={`grading/${gradingRegExp}`} element={<Grading />} key={1} />,
45-
<Route path="xpcalculation" element={<XpCalculation />} key={2} />,
46-
<Route path="sourcereel" element={<Sourcereel />} key={3} />,
47-
<Route path="storysimulator" element={<StorySimulator />} key={4} />,
48-
<Route path="dashboard" element={<Dashboard />} key={5} />
44+
<Route path="sourcereel" element={<Sourcereel />} key={2} />,
45+
<Route path="storysimulator" element={<StorySimulator />} key={3} />,
46+
<Route path="dashboard" element={<Dashboard />} key={4} />
4947
]
5048
: null;
5149
return (

0 commit comments

Comments
 (0)