Merge branch 'develop' into ENCOA-83_MasterStatistical

This commit is contained in:
Joao Ramos
2024-08-20 01:16:46 +01:00
14 changed files with 684 additions and 581 deletions

View File

@@ -33,6 +33,11 @@ export const updateExpiryDateOnGroup = async (participantID: string, corporateID
return;
};
export const getGroups = async () => {
const groupDocs = await getDocs(collection(db, "groups"));
return groupDocs.docs.map((x) => ({...x.data(), id: x.id})) as Group[];
};
export const getUserGroups = async (id: string): Promise<Group[]> => {
const groupDocs = await getDocs(query(collection(db, "groups"), where("admin", "==", id)));
return groupDocs.docs.map((x) => ({...x.data(), id})) as Group[];

View File

@@ -26,6 +26,7 @@ export const countExercises = (exercises: Exercise[]) => {
const lengthMap = exercises.map((e) => {
if (e.type === "multipleChoice") return e.questions.length;
if (e.type === "interactiveSpeaking") return e.prompts.length;
if (e.type === "fillBlanks") return e.words.length;
return 1;
});