Revamped the whole Solutions stuff with Zustand
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import {Stat} from "@/interfaces/user";
|
||||
import {capitalize, groupBy} from "lodash";
|
||||
import {convertCamelCaseToReadable} from "@/utils/string";
|
||||
import {UserSolution} from "@/interfaces/exam";
|
||||
|
||||
export const totalExams = (stats: Stat[]): number => {
|
||||
const moduleStats = formatModuleTotalStats(stats);
|
||||
@@ -98,3 +99,14 @@ export const getExamsBySession = (stats: Stat[], session: string) => {
|
||||
|
||||
export const groupBySession = (stats: Stat[]) => groupBy(stats, "session");
|
||||
export const groupByDate = (stats: Stat[]) => groupBy(stats, "date");
|
||||
|
||||
export const convertToUserSolutions = (stats: Stat[]): UserSolution[] => {
|
||||
return stats.map((stat) => ({
|
||||
exercise: stat.exercise,
|
||||
exam: stat.exam,
|
||||
score: stat.score,
|
||||
solutions: stat.solutions,
|
||||
type: stat.type,
|
||||
module: stat.module,
|
||||
}));
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user