qa: Improve design
This commit is contained in:
parent
13588fc634
commit
0e19b59452
19 changed files with 487 additions and 241 deletions
|
|
@ -37,3 +37,19 @@ export const exercicesIdx = derived(
|
|||
return exercices_idx;
|
||||
},
|
||||
);
|
||||
|
||||
export const exercicesByTheme = derived(
|
||||
exercices,
|
||||
$exercices => {
|
||||
const exercices_idx = { };
|
||||
|
||||
for (const e of $exercices) {
|
||||
if (!exercices_idx[e.id_theme]) {
|
||||
exercices_idx[e.id_theme] = []
|
||||
}
|
||||
exercices_idx[e.id_theme].push(e);
|
||||
}
|
||||
|
||||
return exercices_idx;
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { writable } from 'svelte/store';
|
||||
import { writable, derived } from 'svelte/store';
|
||||
|
||||
import { getQAWork } from '$lib/todo'
|
||||
import { getQAView, getQAWork } from '$lib/todo';
|
||||
|
||||
function createTodosStore() {
|
||||
const { subscribe, set, update } = writable([]);
|
||||
|
|
@ -24,3 +24,39 @@ function createTodosStore() {
|
|||
}
|
||||
|
||||
export const todos = createTodosStore();
|
||||
|
||||
function createViewStore() {
|
||||
const { subscribe, set, update } = writable([]);
|
||||
|
||||
return {
|
||||
subscribe,
|
||||
|
||||
set: (v) => {
|
||||
update((m) => Object.assign(m, v));
|
||||
},
|
||||
|
||||
update,
|
||||
|
||||
refresh: async () => {
|
||||
const list = await getQAView();
|
||||
update((m) => list);
|
||||
return list;
|
||||
},
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
export const view = createViewStore();
|
||||
|
||||
export const viewIdx = derived(
|
||||
view,
|
||||
$view => {
|
||||
const idx = { };
|
||||
|
||||
for (const v of $view) {
|
||||
idx[v.id_exercice] = v;
|
||||
}
|
||||
|
||||
return idx;
|
||||
}
|
||||
);
|
||||
|
|
|
|||
Reference in a new issue