|
32 | 32 |
|
33 | 33 | onMount(async () => { |
34 | 34 | await assignmentStore.fetch(); |
| 35 | + if ($assignmentsPageSettingsStore) { |
| 36 | + // filter to only include assignments that are in the current school year |
| 37 | + // school year is not the same as calendar year |
| 38 | + // each school year starts in august and ends in august the following year |
| 39 | + const now = DateTime.now(); |
| 40 | + const currentYear = now.month >= 8 ? now.year : now.year - 1; |
| 41 | + $assignmentStore ??= []; |
| 42 | + $assignmentStore = $assignmentStore.filter((opgave) => { |
| 43 | + const frist = DateTime.fromFormat(opgave.frist, 'd/M-yyyy HH:mm'); |
| 44 | + const fristYear = frist.month >= 8 ? frist.year : frist.year - 1; |
| 45 | + return fristYear === currentYear; |
| 46 | + }); |
| 47 | + } |
35 | 48 | originalOpgaver = $assignmentStore || []; |
36 | 49 | search(); |
37 | 50 | }); |
|
47 | 60 | return opgave.status === 'Afleveret' || opgave.status === 'Afsluttet'; |
48 | 61 | } |
49 | 62 | }); |
50 | | -
|
51 | | - if ($assignmentsPageSettingsStore) { |
52 | | - // filter to only include assignments that are in the current school year |
53 | | - // school year is not the same as calendar year |
54 | | - // each school year starts in august and ends in august the following year |
55 | | - const now = DateTime.now(); |
56 | | - const currentYear = now.month >= 8 ? now.year : now.year - 1; |
57 | | - filteredOpgaver = filteredOpgaver.filter((opgave) => { |
58 | | - const frist = DateTime.fromFormat(opgave.frist, 'd/M-yyyy HH:mm'); |
59 | | - const fristYear = frist.month >= 8 ? frist.year : frist.year - 1; |
60 | | - return fristYear === currentYear; |
61 | | - }); |
62 | | - } |
63 | 63 | } |
64 | 64 |
|
65 | 65 | function search() { |
|
0 commit comments