Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Team Assessments #2548

Merged
merged 154 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
154 commits
Select commit Hold shift + click to select a range
83afd98
Migrate ground control table to tanstack, without filtering and sorti…
LuYiting0913 Jun 29, 2023
7bf321e
Add filter to ground control table
LuYiting0913 Jun 29, 2023
476be38
Remove defualt filter for ground control table
LuYiting0913 Jun 30, 2023
9e461d8
Add team size column for ground control table
LuYiting0913 Jun 30, 2023
ed05f1c
Add ID to ground control table
LuYiting0913 Jul 3, 2023
7b82b2b
Update team size edit cell
LuYiting0913 Jul 3, 2023
5037870
Add team size edit column for ground control
LuYiting0913 Jul 5, 2023
385a2c5
Remove console logs
LuYiting0913 Jul 5, 2023
e981325
Replace row-wise update button with one update button
LuYiting0913 Jul 6, 2023
b3b1933
Fix bug of team size edit cell not responding for the first click
LuYiting0913 Jul 7, 2023
142e3c7
Merge pull request #1 from SA-Teams-Assessment/branch-migrate-ground_…
CheongYeeMing Jul 10, 2023
d125fbd
Remove unused logs and dependencies
LuYiting0913 Jul 10, 2023
b39cf4e
Merge pull request #2 from SA-Teams-Assessment/branch-migrate-ground_…
CheongYeeMing Jul 10, 2023
f0a3474
Fix dependency warning for ground control
LuYiting0913 Jul 10, 2023
7c7cffc
Merge pull request #3 from SA-Teams-Assessment/branch-migrate-ground_…
CheongYeeMing Jul 10, 2023
a73bfa0
Establish connection with Backend
CheongYeeMing Jul 19, 2023
b83e001
Modify payload for postTeams API Call
CheongYeeMing Jul 21, 2023
18a8486
Refetch after successfully creating Teams
CheongYeeMing Jul 21, 2023
0003432
Fix page button in team formation
LuYiting0913 Jul 22, 2023
da06f88
Add config file
LuYiting0913 Jul 22, 2023
f74d04f
Modify response payload for fetching students
CheongYeeMing Jul 22, 2023
8206427
Refetch after successfully updating Teams
CheongYeeMing Jul 22, 2023
a2bd140
Add Upload CSV API Call
CheongYeeMing Jul 22, 2023
b9deedf
Update assessment workspace
LuYiting0913 Jul 23, 2023
0c2c94c
Remove console logs
LuYiting0913 Jul 23, 2023
e14568e
Add team information page to assessment workspace
LuYiting0913 Jul 23, 2023
24b1d08
Display names in team info page
LuYiting0913 Jul 23, 2023
7312238
Add team flag to assessment dashboard
LuYiting0913 Jul 23, 2023
b318c22
Fix assessment overview card
LuYiting0913 Jul 24, 2023
8e16989
Modify request to handle 409 Conflict Response
CheongYeeMing Jul 24, 2023
299ad39
Update Upload Teams CSV format
CheongYeeMing Jul 24, 2023
5201eec
Change minTeamSize to 0
CheongYeeMing Jul 26, 2023
e4b706b
Add disable Save button in Assessment Workspace
CheongYeeMing Aug 4, 2023
dca1b93
Add TeamFormationOverview to SessionState
CheongYeeMing Aug 4, 2023
d68d2f4
Revert changes made by Yiting
CheongYeeMing Aug 4, 2023
a0ce806
Add assessment type indication: Team or Individual
CheongYeeMing Aug 4, 2023
a4f246d
Add TeamFormationOverview to AssessmentWorkspce
CheongYeeMing Aug 4, 2023
7d99824
Add role checks to remove error 403
CheongYeeMing Aug 4, 2023
7be37b8
Modify GradingQuestion for team submissions
CheongYeeMing Aug 4, 2023
8bd93a7
Remove console logs
CheongYeeMing Aug 4, 2023
ce23f41
Remove unused code
CheongYeeMing Aug 4, 2023
63aa691
Merge pull request #4 from SA-Teams-Assessment/team-formation
CheongYeeMing Aug 4, 2023
906ff2c
Resolve warning ==
CheongYeeMing Aug 4, 2023
cbdc25c
Add lastModifiedAt field for Answer
CheongYeeMing Aug 5, 2023
b2b1f5b
Add Save-Safe
CheongYeeMing Aug 14, 2023
205ae3b
Update Jest Snapshots
CheongYeeMing Aug 17, 2023
a11591b
Write tests for FE components
CheongYeeMing Aug 17, 2023
43da6e3
Write test for SessionActions
CheongYeeMing Aug 17, 2023
c7b6fbb
Remove commented code
CheongYeeMing Aug 21, 2023
62d60bc
Add comments for API calls
CheongYeeMing Aug 21, 2023
209a723
Retrieve create team error message from BE resp
CheongYeeMing Dec 7, 2023
afddeac
Add Workspace for TeamFormation
CheongYeeMing Dec 7, 2023
8dd6672
Update Team Formation Table Filter
CheongYeeMing Dec 7, 2023
47e0bba
Add Student Name Column Filter
CheongYeeMing Dec 7, 2023
4bc7081
Fix TeamFormation table global student name filter
CheongYeeMing Dec 9, 2023
d08fee8
Fix TeamFormation table global student name filter
CheongYeeMing Dec 9, 2023
defe877
Merge Conflict
CheongYeeMing Dec 9, 2023
d42778c
Merge branch 'master' of https://github.com/source-academy/frontend i…
CheongYeeMing Jan 4, 2024
f6703b3
Retrieve student username to grading
CheongYeeMing Jan 4, 2024
ba711af
Resolve yarn lock
CheongYeeMing Jan 4, 2024
0f0eca7
Split student names in grading editor
LuYiting0913 Jan 5, 2024
2ba9780
Merge branch 'big-merge' of https://github.com/SA-Teams-Assessment/fr…
LuYiting0913 Jan 5, 2024
2676374
Fix Team Submission for GradingOverview
CheongYeeMing Jan 8, 2024
d51bd3f
Fix Grading Table Header
CheongYeeMing Jan 10, 2024
6e65f14
Bump Node.js to version 20, update documentation (#2712)
RichDom2185 Jan 15, 2024
32765fa
Prettier formatting rules
CheongYeeMing Jan 16, 2024
56735bd
Yarn Eslint
CheongYeeMing Jan 16, 2024
b22310a
Update snapshot
CheongYeeMing Jan 17, 2024
c6ef509
Fix yarn run tsc
CheongYeeMing Jan 17, 2024
e336fae
Update snapshot
CheongYeeMing Jan 18, 2024
5dd1c0c
Merge branch 'big-merge' of https://github.com/SA-Teams-Assessment/fr…
CheongYeeMing Jan 18, 2024
4a8bdca
Update failing snapshots
RichDom2185 Jan 18, 2024
3804df3
Remove package-log.json
RichDom2185 Jan 18, 2024
e8fd5e0
Restore old environment visualizer snapshots
RichDom2185 Jan 18, 2024
49ee409
Merge pull request #15 from SA-Teams-Assessment/big-merge
CheongYeeMing Jan 18, 2024
74f67c6
Merge branch 'master' into master
RichDom2185 Jan 18, 2024
8d63f4c
Bump follow-redirects from 1.15.2 to 1.15.4 (#2720)
dependabot[bot] Jan 11, 2024
b5035b7
Merge pull request #16 from SA-Teams-Assessment/big-merge
CheongYeeMing Jan 18, 2024
375601d
Update field to generate new date
CheongYeeMing Jan 20, 2024
bdb95d6
Remove commented code
CheongYeeMing Jan 20, 2024
b3ccd34
Change student fields to array
CheongYeeMing Jan 20, 2024
15ee86e
Separate names in Team Formation Table by comma
CheongYeeMing Jan 20, 2024
a8b0f3b
Add Team related fields to GradingOverview
CheongYeeMing Jan 20, 2024
7df22e6
Fix yarn run tsc
CheongYeeMing Jan 20, 2024
3376cff
Fix formatting issues
CheongYeeMing Jan 20, 2024
3ccf094
Remove commented code
RichDom2185 Jan 21, 2024
4a53a1d
Clean up some code
RichDom2185 Jan 21, 2024
db44153
Update Individual Assignment to have maxTeamSize of 1
CheongYeeMing Jan 21, 2024
0cf1f60
Remove commented code
CheongYeeMing Jan 21, 2024
4a130e6
Correct API response for GradingOverviews
CheongYeeMing Jan 21, 2024
db325ad
Update failing snapshots
CheongYeeMing Jan 21, 2024
5d87c54
Remove unused code
RichDom2185 Jan 22, 2024
b0b9ac9
Merge branch 'master' of https://github.com/source-academy/frontend i…
RichDom2185 Jan 26, 2024
9c69b69
Update snapshots post-merge conflict
RichDom2185 Jan 26, 2024
f2c7e51
Use CSS modules for team formation
RichDom2185 Jan 28, 2024
dffccb8
Fix incorrect minimum team size
RichDom2185 Jan 28, 2024
a5c4dc1
Clean up `GroundControlEditTeamSizeCell`
RichDom2185 Jan 28, 2024
f88a159
Remove unnecessary styles
RichDom2185 Jan 28, 2024
8b973bd
Remove unnecessary function
RichDom2185 Jan 28, 2024
9ddcf3f
Simplify variable name for readability
RichDom2185 Jan 28, 2024
8fbb1f1
Revert "Remove commented code"
RichDom2185 Jan 28, 2024
2609557
Fix data flow for editing max team size
RichDom2185 Jan 28, 2024
612b662
Fix unnecessary API calls
RichDom2185 Jan 28, 2024
d82d577
Merge branch 'master' of https://github.com/source-academy/frontend i…
RichDom2185 Jan 31, 2024
7ccd477
Merge branch 'master' into master
RichDom2185 Feb 3, 2024
5ea359d
Merge branch 'master' into master
RichDom2185 Feb 3, 2024
3851c67
Merge branch 'master' of https://github.com/source-academy/frontend i…
RichDom2185 Feb 5, 2024
98b54fc
Reran yarn install post-merge
RichDom2185 Feb 5, 2024
d46188f
Remove unnecessary stub types package
RichDom2185 Feb 5, 2024
fa181dc
Merge branch 'master' into master
RichDom2185 Feb 5, 2024
2d8f6ff
Merge branch 'master' of https://github.com/source-academy/frontend i…
RichDom2185 Feb 12, 2024
25a4491
Fix format post-merge
RichDom2185 Feb 12, 2024
6f41f59
Update snapshots post-merge
RichDom2185 Feb 12, 2024
8167477
Merge branch 'master' into master
RichDom2185 Feb 13, 2024
e9648eb
Remove TODO comment
RichDom2185 Feb 13, 2024
6bebb24
Make last modified date optional
RichDom2185 Feb 13, 2024
43d4865
Revert "Make last modified date optional"
RichDom2185 Feb 21, 2024
83457a2
Merge branch 'master' of https://github.com/source-academy/frontend i…
RichDom2185 Feb 21, 2024
d292357
Update snapshots post-merge
RichDom2185 Feb 21, 2024
fd96936
Merge branch 'master' of https://github.com/source-academy/frontend i…
RichDom2185 Feb 21, 2024
5628047
Merge branch 'master' of https://github.com/source-academy/frontend i…
RichDom2185 Feb 22, 2024
508c540
Migrate new action creators to RTK
RichDom2185 Feb 22, 2024
09ddd05
Fix incorrect past merge conflict resolution
RichDom2185 Feb 22, 2024
1b0f0db
Improve codebase consistency
RichDom2185 Feb 22, 2024
86af672
Update lockfile
RichDom2185 Feb 22, 2024
e942455
Merge branch 'master' of https://github.com/source-academy/frontend i…
RichDom2185 Feb 23, 2024
ea97f8b
Update snapshots post-merge
RichDom2185 Feb 23, 2024
c0112e8
Merge branch 'master' of https://github.com/source-academy/frontend i…
RichDom2185 Feb 23, 2024
604dd30
Format files post-merge
RichDom2185 Feb 23, 2024
b51f7ac
Merge branch 'master' of https://github.com/source-academy/frontend i…
RichDom2185 Feb 23, 2024
0e2feeb
Merge branch 'master' into master
RichDom2185 Feb 23, 2024
3bb11ce
Fix errors post-merge
RichDom2185 Feb 23, 2024
a96a141
Merge branch 'master' into master
RichDom2185 Feb 24, 2024
3395f33
Merge branch 'master' into master
RichDom2185 Feb 24, 2024
84affb5
Merge branch 'master' into master
RichDom2185 Feb 24, 2024
8065fb8
Merge branch 'master' into master
RichDom2185 Feb 26, 2024
0348b6e
Restore comment
RichDom2185 Feb 26, 2024
20ed172
Fix incorrect condition check
RichDom2185 Feb 26, 2024
025479d
Merge branch 'master' into master
RichDom2185 Mar 1, 2024
66ff405
Merge branch 'master' of https://github.com/source-academy/frontend i…
RichDom2185 Mar 2, 2024
fdfdf69
Merge branch 'master' of https://github.com/source-academy/frontend i…
RichDom2185 Mar 17, 2024
eb201a5
Update lockfile post merge
RichDom2185 Mar 17, 2024
e58b3b7
Migrate team actions to RTK
RichDom2185 Mar 17, 2024
2677e6a
Fix tests
RichDom2185 Mar 17, 2024
2e6018f
Merge branch 'master' into master
RichDom2185 Mar 17, 2024
eade465
Merge branch 'master' into master
RichDom2185 Mar 17, 2024
1478194
Merge branch 'master' into master
RichDom2185 Mar 18, 2024
89b4565
Merge branch 'master' into master
RichDom2185 Mar 21, 2024
ec86349
Merge branch 'master' into master
RichDom2185 Mar 22, 2024
b5f29f4
Merge branch 'master' into master
RichDom2185 Mar 23, 2024
c8c283f
Fix compile error post-merge
RichDom2185 Mar 23, 2024
2990516
Merge branch 'master' into master
RichDom2185 Mar 24, 2024
e43e474
Fix lint
RichDom2185 Mar 24, 2024
f11b59b
Merge branch 'master' into master
RichDom2185 Mar 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"react-copy-to-clipboard": "^5.1.0",
"react-debounce-render": "^8.0.2",
"react-dom": "^18.2.0",
"react-drag-drop-files": "^2.3.10",
"react-draggable": "^4.4.5",
"react-dropzone": "^14.2.3",
"react-hotkeys": "^2.0.0",
Expand All @@ -77,6 +78,7 @@
"react-redux": "^8.1.1",
"react-responsive": "^10.0.0",
"react-router-dom": "^6.14.1",
"react-select": "^5.7.3",
"react-simple-keyboard": "^3.6.27",
"react-sortable-hoc": "^2.0.0",
"react-syntax-highlighter": "^15.5.0",
Expand All @@ -90,6 +92,7 @@
"typesafe-actions": "^5.1.0",
"unified": "^11.0.0",
"uuid": "^9.0.0",
"xlsx": "0.16.4",
"xml2js": "^0.6.0",
"yareco": "^0.1.5"
},
Expand Down
4 changes: 3 additions & 1 deletion src/commons/XMLParser/XMLParserHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ const makeAssessmentOverview = (result: any, maxXpVal: number): AssessmentOvervi
status: AssessmentStatuses.attempting,
story: rawOverview.story,
xp: 0,
gradingStatus: 'none' as GradingStatuses
gradingStatus: 'none' as GradingStatuses,
maxTeamSize: 1
};
};

Expand Down Expand Up @@ -202,6 +203,7 @@ const makeProgramming = (
testcases: publicTestcases.map(testcase => makeTestcase(testcase)),
testcasesPrivate: privateTestcases.map(testcase => makeTestcase(testcase)),
answer: solution ? (solution[0] as string).trim() : '',
lastModifiedAt: new Date().toISOString(),
type: 'programming'
};
if (problem.SNIPPET[0].GRADER) {
Expand Down
17 changes: 17 additions & 0 deletions src/commons/application/ApplicationTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,19 @@ export const defaultWorkspaceManager: WorkspaceManagerState = {
currentQuestion: undefined,
hasUnsavedChanges: false
},
teamFormation: {
...createDefaultWorkspace('teamFormation'),
teamFormationTableFilters: {
columnFilters: [],
globalFilter: null
}
},
groundControl: {
...createDefaultWorkspace('groundControl'),
GroundControlTableFilters: {
columnFilters: []
}
},
playground: {
...createDefaultWorkspace('playground'),
usingSubst: false,
Expand Down Expand Up @@ -500,6 +513,8 @@ export const defaultSession: SessionState = {
sessionId: Date.now(),
githubOctokitObject: { octokit: undefined },
gradingOverviews: undefined,
students: undefined,
teamFormationOverviews: undefined,
gradings: new Map<number, GradingQuery>(),
notifications: []
};
Expand Down Expand Up @@ -539,6 +554,8 @@ export const defaultSideContentManager: SideContentManagerState = {
assessment: defaultSideContent,
grading: defaultSideContent,
playground: defaultSideContent,
groundControl: defaultSideContent,
teamFormation: defaultSideContent,
sicp: defaultSideContent,
sourcecast: defaultSideContent,
sourcereel: defaultSideContent,
Expand Down
67 changes: 67 additions & 0 deletions src/commons/application/actions/SessionActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import {
paginationToBackendParams,
ungradedToBackendParams
} from 'src/features/grading/GradingUtils';
import { OptionType } from 'src/pages/academy/teamFormation/subcomponents/TeamFormationForm';

import { GradingOverviews, GradingQuery } from '../../../features/grading/GradingTypes';
import { TeamFormationOverview } from '../../../features/teamFormation/TeamFormationTypes';
import {
Assessment,
AssessmentConfiguration,
Expand All @@ -20,8 +22,12 @@ import { Role } from '../ApplicationTypes';
import {
ACKNOWLEDGE_NOTIFICATIONS,
AdminPanelCourseRegistration,
BULK_UPLOAD_TEAM,
CHECK_ANSWER_LAST_MODIFIED_AT,
CourseRegistration,
CREATE_TEAM,
DELETE_ASSESSMENT_CONFIG,
DELETE_TEAM,
DELETE_TIME_OPTIONS,
DELETE_USER_COURSE_REGISTRATION,
FETCH_ADMIN_PANEL_COURSE_REGISTRATIONS,
Expand All @@ -36,6 +42,9 @@ import {
FETCH_GRADING_OVERVIEWS,
FETCH_NOTIFICATION_CONFIGS,
FETCH_NOTIFICATIONS,
FETCH_STUDENTS,
FETCH_TEAM_FORMATION_OVERVIEW,
FETCH_TEAM_FORMATION_OVERVIEWS,
FETCH_TOTAL_XP,
FETCH_TOTAL_XP_ADMIN,
FETCH_USER_AND_COURSE,
Expand Down Expand Up @@ -77,6 +86,10 @@ import {
UPDATE_NOTIFICATION_CONFIG,
UPDATE_NOTIFICATION_PREFERENCES,
UPDATE_NOTIFICATIONS,
UPDATE_STUDENTS,
UPDATE_TEAM,
UPDATE_TEAM_FORMATION_OVERVIEW,
UPDATE_TEAM_FORMATION_OVERVIEWS,
UPDATE_TIME_OPTIONS,
UPDATE_TOTAL_XP,
UPDATE_USER_ROLE,
Expand Down Expand Up @@ -137,6 +150,13 @@ export const fetchGradingOverviews = createAction(
) => ({ payload: { filterToGroup, gradedFilter, pageParams, filterParams } })
);

export const fetchTeamFormationOverviews = createAction(
FETCH_TEAM_FORMATION_OVERVIEWS,
(filterToGroup = true) => ({ payload: filterToGroup })
);

export const fetchStudents = createAction(FETCH_STUDENTS, () => ({ payload: {} }));

export const login = createAction(LOGIN, (providerId: string) => ({ payload: providerId }));

export const logoutGoogle = createAction(LOGOUT_GOOGLE, () => ({ payload: {} }));
Expand Down Expand Up @@ -202,6 +222,13 @@ export const submitAnswer = createAction(
(id: number, answer: string | number | ContestEntry[]) => ({ payload: { id, answer } })
);

export const checkAnswerLastModifiedAt = createAction(
CHECK_ANSWER_LAST_MODIFIED_AT,
(id: number, lastModifiedAt: string, saveAnswer: Function) => ({
payload: { id, lastModifiedAt, saveAnswer }
})
);

export const submitAssessment = createAction(SUBMIT_ASSESSMENT, (id: number) => ({ payload: id }));

export const submitGrading = createAction(
Expand Down Expand Up @@ -246,6 +273,46 @@ export const updateGradingOverviews = createAction(
(overviews: GradingOverviews) => ({ payload: overviews })
);

export const fetchTeamFormationOverview = createAction(
FETCH_TEAM_FORMATION_OVERVIEW,
(assessmentId: number) => ({ payload: { assessmentId } })
);

export const createTeam = createAction(
CREATE_TEAM,
(assessment: AssessmentOverview, teams: OptionType[][]) => ({ payload: { assessment, teams } })
);

export const updateTeam = createAction(
UPDATE_TEAM,
(teamId: number, assessment: AssessmentOverview, teams: OptionType[][]) => ({
payload: { teamId, assessment, teams }
})
);

export const deleteTeam = createAction(DELETE_TEAM, (teamId: number) => ({ payload: { teamId } }));

export const bulkUploadTeam = createAction(
BULK_UPLOAD_TEAM,
(assessment: AssessmentOverview, file: File, students: User[] | undefined) => ({
payload: { assessment, file, students }
})
);

export const updateTeamFormationOverviews = createAction(
UPDATE_TEAM_FORMATION_OVERVIEWS,
(overviews: TeamFormationOverview[]) => ({ payload: overviews })
);

export const updateTeamFormationOverview = createAction(
UPDATE_TEAM_FORMATION_OVERVIEW,
(overview: TeamFormationOverview) => ({ payload: overview })
);

export const updateStudents = createAction(UPDATE_STUDENTS, (students: User[]) => ({
payload: students
}));

/**
* An extra id parameter is included here because of
* no id for Grading.
Expand Down
92 changes: 90 additions & 2 deletions src/commons/application/actions/__tests__/SessionActions.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { Chapter, Variant } from 'js-slang/dist/types';
import { mockStudents } from 'src/commons/mocks/UserMocks';
import {
paginationToBackendParams,
ungradedToBackendParams
} from 'src/features/grading/GradingUtils';

import { GradingOverviews, GradingQuery } from '../../../../features/grading/GradingTypes';
import { TeamFormationOverview } from '../../../../features/teamFormation/TeamFormationTypes';
import { Assessment, AssessmentOverview } from '../../../assessment/AssessmentTypes';
import { Notification } from '../../../notificationBadge/NotificationBadgeTypes';
import { GameState, Role, Story } from '../../ApplicationTypes';
Expand All @@ -21,6 +23,8 @@ import {
FETCH_GRADING,
FETCH_GRADING_OVERVIEWS,
FETCH_NOTIFICATIONS,
FETCH_STUDENTS,
FETCH_TEAM_FORMATION_OVERVIEWS,
FETCH_USER_AND_COURSE,
LOGIN,
REAUTOGRADE_ANSWER,
Expand All @@ -47,7 +51,11 @@ import {
UPDATE_GRADING_OVERVIEWS,
UPDATE_LATEST_VIEWED_COURSE,
UPDATE_NOTIFICATIONS,
UPDATE_USER_ROLE
UPDATE_STUDENTS,
UPDATE_TEAM_FORMATION_OVERVIEW,
UPDATE_TEAM_FORMATION_OVERVIEWS,
UPDATE_USER_ROLE,
User
} from '../../types/SessionTypes';
import {
acknowledgeNotifications,
Expand All @@ -62,6 +70,8 @@ import {
fetchGrading,
fetchGradingOverviews,
fetchNotifications,
fetchStudents,
fetchTeamFormationOverviews,
fetchUserAndCourse,
login,
reautogradeAnswer,
Expand All @@ -88,6 +98,9 @@ import {
updateGradingOverviews,
updateLatestViewedCourse,
updateNotifications,
updateStudents,
updateTeamFormationOverview,
updateTeamFormationOverviews,
updateUserRole
} from '../SessionActions';

Expand Down Expand Up @@ -183,6 +196,31 @@ test('fetchGradingOverviews generates correct action object', () => {
});
});

test('fetchTeamFormationOverviews generates correct default action object', () => {
const action = fetchTeamFormationOverviews();
expect(action).toEqual({
type: FETCH_TEAM_FORMATION_OVERVIEWS,
payload: true
});
});

test('fetchTeamFormationOverviews generates correct action object', () => {
const filterToGroup = false;
const action = fetchTeamFormationOverviews(filterToGroup);
expect(action).toEqual({
type: FETCH_TEAM_FORMATION_OVERVIEWS,
payload: filterToGroup
});
});

test('fetchStudents generates correct action object', () => {
const action = fetchStudents();
expect(action).toEqual({
type: FETCH_STUDENTS,
payload: {}
});
});

test('fetchNotifications generates correct action object', () => {
const action = fetchNotifications();

Expand Down Expand Up @@ -217,6 +255,7 @@ test('setUser generates correct action object', () => {
const user = {
userId: 123,
name: 'test student',
username: 'test student',
courses: [
{
courseId: 1,
Expand Down Expand Up @@ -501,7 +540,8 @@ test('updateAssessmentOverviews generates correct action object', () => {
status: 'not_attempted',
story: null,
xp: 0,
gradingStatus: 'none'
gradingStatus: 'none',
maxTeamSize: 1
}
];
const action = updateAssessmentOverviews(overviews);
Expand Down Expand Up @@ -546,7 +586,9 @@ test('updateGradingOverviews generates correct action object', () => {
maxXp: 500,
studentId: 100,
studentName: 'test student',
studentNames: [],
studentUsername: 'E0123456',
studentUsernames: [],
submissionId: 1,
submissionStatus: 'attempting',
groupName: 'group',
Expand All @@ -564,6 +606,52 @@ test('updateGradingOverviews generates correct action object', () => {
});
});

test('updateStudents generates correct action object', () => {
const students: User[] = mockStudents;

const action = updateStudents(students);
expect(action).toEqual({
type: UPDATE_STUDENTS,
payload: students
});
});

test('updateTeamFormationOverview generates correct action object', () => {
const overview: TeamFormationOverview = {
teamId: 0,
assessmentId: 1,
assessmentName: 'Mission 1',
assessmentType: 'Missions',
studentIds: [0],
studentNames: ['Mark Henry']
};

const action = updateTeamFormationOverview(overview);
expect(action).toEqual({
type: UPDATE_TEAM_FORMATION_OVERVIEW,
payload: overview
});
});

test('updateTeamFormationOverviews generates correct action object', () => {
const overviews: TeamFormationOverview[] = [
{
teamId: 0,
assessmentId: 0,
assessmentName: 'Mission 2',
assessmentType: 'Missions',
studentIds: [0],
studentNames: ['Mark Henry']
}
];

const action = updateTeamFormationOverviews(overviews);
expect(action).toEqual({
type: UPDATE_TEAM_FORMATION_OVERVIEWS,
payload: overviews
});
});

test('updateGrading generates correct action object', () => {
const submissionId = 3;
const grading: GradingQuery = {
Expand Down
18 changes: 18 additions & 0 deletions src/commons/application/reducers/SessionsReducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ import {
UPDATE_GRADING,
UPDATE_GRADING_OVERVIEWS,
UPDATE_NOTIFICATIONS,
UPDATE_STUDENTS,
UPDATE_TEAM_FORMATION_OVERVIEW,
UPDATE_TEAM_FORMATION_OVERVIEWS,
UPDATE_TOTAL_XP
} from '../types/SessionTypes';

Expand Down Expand Up @@ -122,6 +125,21 @@ export const SessionsReducer: Reducer<SessionState, SourceActionType> = (
...state,
notifications: action.payload
};
case UPDATE_STUDENTS:
return {
...state,
students: action.payload
};
case UPDATE_TEAM_FORMATION_OVERVIEWS:
return {
...state,
teamFormationOverviews: action.payload
};
case UPDATE_TEAM_FORMATION_OVERVIEW:
return {
...state,
teamFormationOverview: action.payload
};
case REMOTE_EXEC_UPDATE_DEVICES:
return {
...state,
Expand Down
Loading
Loading