Show the Company Name of the Teachers and students that are linked in the User List View

This commit is contained in:
Tiago Ribeiro
2024-04-03 22:46:31 +01:00
parent 9ab7c3ed59
commit 2de4b7c715
2 changed files with 68 additions and 23 deletions

View File

@@ -9,6 +9,24 @@ export function dateSorter(a: any, b: any, direction: "asc" | "desc", key: strin
return 0;
}
export async function asyncSorter<T>(array: T[], sorterFunction: (a: T, b: T) => Promise<number>): Promise<T[]> {
let swapped = false;
do {
swapped = false;
for (let i = 0; i < array.length - 1; i++) {
const result = await sorterFunction(array[i], array[i + 1]);
if (result < 0) {
const aux = array[i + 1];
array[i + 1] = array[i];
array[i] = aux;
swapped = true;
}
}
} while (swapped);
return array;
}
export function env(key: string) {
return (window as any).__ENV[key];
}