Skip to content
This repository has been archived by the owner on Jun 1, 2024. It is now read-only.

Commit

Permalink
Remove assignment sorting in frontend as it has been moved to the bac…
Browse files Browse the repository at this point in the history
…kend
  • Loading branch information
Adamv27 committed Apr 3, 2024
1 parent 69684b0 commit fde2df2
Showing 1 changed file with 2 additions and 23 deletions.
25 changes: 2 additions & 23 deletions api.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,6 @@ export function getEnrollments() {
}

export function getStudentAssignments(slug) {
const activitySort = (a, b) => { // FIXME: this is a disaster.
const ordering = {
Melody: 1,
Bassline: 2,
Creativity: 3,
Reflection: 4,
Connect: 5,
Aural: 3,
Exploratory: 3,
Theoretical: 3,
MelodyPost: 3.1,
BasslinePost: 3.2,
};
const c = a.activity_type_name.split(' ')[0];
const d = b.activity_type_name.split(' ')[0];
const result = ordering[c] - ordering[d];
return result;
};
return () =>
getSession()
.then((session) => {
Expand All @@ -58,11 +40,8 @@ export function getStudentAssignments(slug) {
}
);
})
.then((response) => response.json())
.then((results) => {
// FIXME: this should respect order from server/pieceplan and mayeb do this as a backup?
Object.values(results).forEach(pieceAssignments=>pieceAssignments.sort(activitySort));
return results;
.then((response) => {
return response.json()
});
}

Expand Down

0 comments on commit fde2df2

Please sign in to comment.