+
+
+
+
{{ $t("Nächste Termine") }}
-
+
{{ $t("dueDates.noDueDatesAvailable") }}
+
+
+ {{ $t("a.Alle Termine anzeigen") }}
+
diff --git a/client/src/composables.ts b/client/src/composables.ts
index 8cc0f03e..c733f092 100644
--- a/client/src/composables.ts
+++ b/client/src/composables.ts
@@ -34,6 +34,7 @@ import type {
PerformanceCriteria,
} from "@/types";
import { useQuery } from "@urql/vue";
+import dayjs from "dayjs";
import { t } from "i18next";
import orderBy from "lodash/orderBy";
import log from "loglevel";
@@ -502,6 +503,9 @@ export function useDashboardPersons() {
const dashboardDueDates = ref
([]);
const loading = ref(false);
+ // due dates from today to the next year
+ const currentDueDates = ref([]);
+
const fetchData = async () => {
loading.value = true;
try {
@@ -519,6 +523,18 @@ export function useDashboardPersons() {
}
return dueDate;
});
+
+ currentDueDates.value = dashboardDueDates.value.filter((dueDate) => {
+ let refDate = dayjs(dueDate.start);
+ if (dueDate.end) {
+ refDate = dayjs(dueDate.end);
+ }
+
+ return (
+ refDate >= dayjs().startOf("day") &&
+ refDate <= dayjs().add(1, "year").endOf("day")
+ );
+ });
} catch (error) {
console.error("Error fetching data:", error);
} finally {
@@ -531,6 +547,7 @@ export function useDashboardPersons() {
return {
dashboardPersons,
dashboardDueDates,
+ currentDueDates,
loading,
};
}
diff --git a/client/src/pages/dashboard/DashboardDueDatesPage.vue b/client/src/pages/dashboard/DashboardDueDatesPage.vue
index f427ee25..cb1397b7 100644
--- a/client/src/pages/dashboard/DashboardDueDatesPage.vue
+++ b/client/src/pages/dashboard/DashboardDueDatesPage.vue
@@ -24,7 +24,7 @@ type CourseItem = DropboxItem & {
const { t } = useTranslation();
-const { loading, dashboardDueDates } = useDashboardPersons();
+const { loading, currentDueDates: dashboardDueDates } = useDashboardPersons();
const courses = computed(() => {
return [
diff --git a/server/vbv_lernwelt/dashboard/views.py b/server/vbv_lernwelt/dashboard/views.py
index 6011354a..bac8875f 100644
--- a/server/vbv_lernwelt/dashboard/views.py
+++ b/server/vbv_lernwelt/dashboard/views.py
@@ -248,13 +248,13 @@ def get_dashboard_due_dates(request):
due_dates = []
today = date.today()
for due_date in all_due_dates:
- due_dates.append(due_date)
- # if due_date.end:
- # if due_date.end.date() >= today:
- # due_dates.append(due_date)
- # elif due_date.start:
- # if due_date.start.date() >= today:
- # due_dates.append(due_date)
+ # due_dates.append(due_date)
+ if due_date.end:
+ if due_date.end.date() >= today:
+ due_dates.append(due_date)
+ elif due_date.start:
+ if due_date.start.date() >= today:
+ due_dates.append(due_date)
due_dates.sort(key=lambda x: x.start)