Skip to content

Commit

Permalink
Revert "Add total XP table" feature (#2780)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
RichDom2185 authored Feb 14, 2024
1 parent 4f55b88 commit 60eb5e2
Show file tree
Hide file tree
Showing 11 changed files with 6 additions and 302 deletions.
1 change: 0 additions & 1 deletion src/commons/application/ApplicationTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,6 @@ export const defaultSession: SessionState = {
collectibles: {}
},
xp: 0,
allUserXp: undefined,
story: {
story: '',
playStory: false
Expand Down
6 changes: 0 additions & 6 deletions src/commons/application/actions/SessionActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
DELETE_TIME_OPTIONS,
DELETE_USER_COURSE_REGISTRATION,
FETCH_ADMIN_PANEL_COURSE_REGISTRATIONS,
FETCH_ALL_USER_XP,
FETCH_ASSESSMENT,
FETCH_ASSESSMENT_ADMIN,
FETCH_ASSESSMENT_CONFIGS,
Expand Down Expand Up @@ -65,7 +64,6 @@ import {
TimeOption,
Tokens,
UNSUBMIT_SUBMISSION,
UPDATE_ALL_USER_XP,
UPDATE_ASSESSMENT,
UPDATE_ASSESSMENT_CONFIGS,
UPDATE_ASSESSMENT_OVERVIEWS,
Expand Down Expand Up @@ -103,8 +101,6 @@ export const fetchTotalXp = () => action(FETCH_TOTAL_XP);

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

export const fetchAllUserXp = () => action(FETCH_ALL_USER_XP);

export const fetchGrading = (submissionId: number) => action(FETCH_GRADING, submissionId);

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

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

export const updateAllUserXp = (allUserXp: string[][]) => action(UPDATE_ALL_USER_XP, allUserXp);

export const updateAssessment = (assessment: Assessment) => action(UPDATE_ASSESSMENT, assessment);

export const updateGradingOverviews = (overviews: GradingOverview[]) =>
Expand Down
3 changes: 0 additions & 3 deletions src/commons/application/reducers/SessionsReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
SET_NOTIFICATION_CONFIGS,
SET_TOKENS,
SET_USER,
UPDATE_ALL_USER_XP,
UPDATE_ASSESSMENT,
UPDATE_ASSESSMENT_OVERVIEWS,
UPDATE_GRADING,
Expand Down Expand Up @@ -112,8 +111,6 @@ export const SessionsReducer: Reducer<SessionState> = (
};
case UPDATE_TOTAL_XP:
return { ...state, xp: action.payload };
case UPDATE_ALL_USER_XP:
return { ...state, allUserXp: action.payload };
case UPDATE_GRADING:
const newGradings = new Map(state.gradings);
newGradings.set(action.payload.submissionId, action.payload.grading);
Expand Down
3 changes: 0 additions & 3 deletions src/commons/application/types/SessionTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ export const FETCH_COURSE_CONFIG = 'FETCH_COURSE_CONFIG';
export const FETCH_ASSESSMENT = 'FETCH_ASSESSMENT';
export const FETCH_ASSESSMENT_ADMIN = 'FETCH_ASSESSMENT_ADMIN';
export const FETCH_ASSESSMENT_OVERVIEWS = 'FETCH_ASSESSMENT_OVERVIEWS';
export const FETCH_ALL_USER_XP = 'FETCH_ALL_USER_XP';
export const FETCH_TOTAL_XP = 'FETCH_TOTAL_XP';
export const FETCH_TOTAL_XP_ADMIN = 'FETCH_TOTAL_XP_ADMIN';
export const FETCH_GRADING = 'FETCH_GRADING';
Expand Down Expand Up @@ -48,7 +47,6 @@ export const REMOVE_GITHUB_OCTOKIT_OBJECT_AND_ACCESS_TOKEN =
export const UNSUBMIT_SUBMISSION = 'UNSUBMIT_SUBMISSION';
export const UPDATE_ASSESSMENT_OVERVIEWS = 'UPDATE_ASSESSMENT_OVERVIEWS';
export const UPDATE_TOTAL_XP = 'UPDATE_TOTAL_XP';
export const UPDATE_ALL_USER_XP = 'UPDATE_ALL_USER_XP';
export const UPDATE_ASSESSMENT = 'UPDATE_ASSESSMENT';
export const UPDATE_GRADING_OVERVIEWS = 'UPDATE_GRADING_OVERVIEWS';
export const UPDATE_GRADING = 'UPDATE_GRADING';
Expand Down Expand Up @@ -93,7 +91,6 @@ export type SessionState = {
readonly gameState: GameState;
readonly courseId?: number;
readonly xp: number;
readonly allUserXp: string[][] | undefined;
readonly story: Story;

// Course Configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,6 @@ const getStaffNavlinkInfo = ({
disabled: !isStaffOrAdmin,
hiddenInBreakpoints: ['xs', 'sm', 'md']
},
{
to: `/courses/${courseId}/xpcalculation`,
icon: IconNames.CALCULATOR,
text: 'XP Calculation',
disabled: !isAdmin,
hiddenInBreakpoints: ['xs', 'sm', 'md', 'lg']
},
{
to: `/courses/${courseId}/adminpanel`,
icon: IconNames.SETTINGS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const useSelectorMock = useSelector as jest.Mock;

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

Expand Down Expand Up @@ -71,7 +71,7 @@ test('MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard and G
validateAdminPaths(tree, false);
});

test('MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, Grading, XP Calculation and AdminPanel NavLinks render for Role.Admin', () => {
test('MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, Grading and AdminPanel NavLinks render for Role.Admin', () => {
useSelectorMock.mockReturnValueOnce({
role: Role.Admin,
courseId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, G
</Blueprint5.Navbar>
`;

exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, Grading, XP Calculation and AdminPanel NavLinks render for Role.Admin 1`] = `
exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, Grading and AdminPanel NavLinks render for Role.Admin 1`] = `
<Blueprint5.Navbar
className="NavigationBar secondary-navbar"
>
Expand Down Expand Up @@ -541,22 +541,6 @@ exports[`MissionControl, GroundControl, Sourcereel, StorySimulator, Dashboard, G
Game Simulator
</div>
</NavLink>
<NavLink
className={[Function]}
title="XP Calculation"
to="/courses/0/xpcalculation"
>
<Blueprint5.Icon
autoLoad={true}
icon="calculator"
tagName="span"
/>
<div
className="hidden-xs hidden-sm hidden-md hidden-lg"
>
XP Calculation
</div>
</NavLink>
<NavLink
className={[Function]}
title="Admin Panel"
Expand Down
11 changes: 0 additions & 11 deletions src/commons/sagas/BackendSaga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import {
DELETE_TIME_OPTIONS,
DELETE_USER_COURSE_REGISTRATION,
FETCH_ADMIN_PANEL_COURSE_REGISTRATIONS,
FETCH_ALL_USER_XP,
FETCH_ASSESSMENT,
FETCH_ASSESSMENT_ADMIN,
FETCH_ASSESSMENT_CONFIGS,
Expand Down Expand Up @@ -87,7 +86,6 @@ import { CHANGE_SUBLANGUAGE, WorkspaceLocation } from '../workspace/WorkspaceTyp
import {
deleteAssessment,
deleteSourcecastEntry,
getAllUserXp,
getAssessment,
getAssessmentConfigs,
getAssessmentOverviews,
Expand Down Expand Up @@ -286,15 +284,6 @@ function* BackendSaga(): SagaIterator {
}
});

yield takeEvery(FETCH_ALL_USER_XP, function* () {
const tokens: Tokens = yield selectTokens();

const res: { all_users_xp: string[][] } = yield call(getAllUserXp, tokens);
if (res) {
yield put(actions.updateAllUserXp(res.all_users_xp));
}
});

yield takeEvery(FETCH_TOTAL_XP, function* () {
const tokens: Tokens = yield selectTokens();

Expand Down
14 changes: 0 additions & 14 deletions src/commons/sagas/RequestsSaga.ts
Original file line number Diff line number Diff line change
Expand Up @@ -454,20 +454,6 @@ export const getTotalXp = async (tokens: Tokens, courseRegId?: number): Promise<
return totalXp;
};

/**
* GET /courses/{courseId}/admin/users/total_xp
*/
export const getAllUserXp = async (tokens: Tokens): Promise<number | null> => {
const resp = await request(`${courseId()}/admin/users/total_xp`, 'GET', {
...tokens
});
if (!resp || !resp.ok) {
return null; // invalid accessToken _and_ refreshToken
}
const totalXp = await resp.json();
return totalXp;
};

/**
* GET /courses/{courseId}/admin/users/{course_reg_id}/assessments
*/
Expand Down
8 changes: 3 additions & 5 deletions src/pages/academy/Academy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import GroundControl from './groundControl/GroundControlContainer';
import NotiPreference from './notiPreference/NotiPreference';
import Sourcereel from './sourcereel/Sourcereel';
import StorySimulator from './storySimulator/StorySimulator';
import XpCalculation from './xpCalculation/XpCalculation';

const Academy: React.FC<{}> = () => {
const dispatch = useDispatch();
Expand All @@ -42,10 +41,9 @@ const Academy: React.FC<{}> = () => {
? [
<Route path="groundcontrol" element={<GroundControl />} key={0} />,
<Route path={`grading/${gradingRegExp}`} element={<Grading />} key={1} />,
<Route path="xpcalculation" element={<XpCalculation />} key={2} />,
<Route path="sourcereel" element={<Sourcereel />} key={3} />,
<Route path="storysimulator" element={<StorySimulator />} key={4} />,
<Route path="dashboard" element={<Dashboard />} key={5} />
<Route path="sourcereel" element={<Sourcereel />} key={2} />,
<Route path="storysimulator" element={<StorySimulator />} key={3} />,
<Route path="dashboard" element={<Dashboard />} key={4} />
]
: null;
return (
Expand Down
Loading

0 comments on commit 60eb5e2

Please sign in to comment.