Author SHA1 Message Date
klemek 6e508547fc chore: 1.7.3
Python Lint CI / ruff (push) Successful in 6m21s
Python Lint CI / ruff-format-check (push) Successful in 5m58s
Python Lint CI / ty (push) Successful in 6m31s
Docker Build / build (push) Successful in 12m58s
TS Lint / ESLint (push) Successful in 6m3s
TS Lint / Oxlint (push) Successful in 6m0s
TS Lint / TypeScript (push) Successful in 6m20s
2026-08-02 09:04:21 +02:00
klemek eea6825ac7 fix: every day without hour 2026-08-02 09:04:15 +02:00
klemek d8c7cc498d fix: separate newly created with a fallback date 2026-08-02 09:03:13 +02:00
klemek 7d2e8cae5d fix: remove unused function 2026-08-02 08:59:20 +02:00
klemek f680b04533 perf: faster app without defineAsync 2026-08-02 08:59:13 +02:00
klemek fe5c0f94b2 chore: 1.7.2
Python Lint CI / ruff (push) Successful in 7m14s
Python Lint CI / ruff-format-check (push) Successful in 7m8s
Python Lint CI / ty (push) Successful in 6m54s
TS Lint / ESLint (push) Successful in 5m39s
Docker Build / build (push) Successful in 13m11s
TS Lint / Oxlint (push) Failing after 5m35s
TS Lint / TypeScript (push) Successful in 5m14s
2026-07-31 16:09:18 +02:00
klemek 664b47aa75 fix: cron input
Docker Build / build (push) Has been cancelled
TS Lint / ESLint (push) Has been cancelled
TS Lint / Oxlint (push) Has been cancelled
TS Lint / TypeScript (push) Has been cancelled
2026-07-31 16:09:09 +02:00
klemek ce795582f9 chore: 1.7.1
Python Lint CI / ruff (push) Successful in 7m31s
Python Lint CI / ruff-format-check (push) Successful in 4m51s
Python Lint CI / ty (push) Successful in 6m49s
Docker Build / build (push) Successful in 14m13s
TS Lint / Oxlint (push) Failing after 4m5s
TS Lint / ESLint (push) Successful in 4m46s
TS Lint / TypeScript (push) Successful in 2m13s
2026-07-29 15:14:33 +02:00
klemek bd87e5acf5 refactor: perfect cron rule string 2026-07-29 15:14:26 +02:00
klemek 9081891d8f refator: separate cron input 2026-07-29 15:14:15 +02:00
klemek 9b6d43253e chore: 1.7.0
Python Lint CI / ty (push) Successful in 4m49s
Python Lint CI / ruff-format-check (push) Successful in 5m7s
TS Lint / ESLint (push) Successful in 5m34s
TS Lint / Oxlint (push) Successful in 11m18s
TS Lint / TypeScript (push) Successful in 12m41s
Docker Build / build (push) Successful in 18m43s
Python Lint CI / ruff (push) Successful in 4m50s
2026-07-29 14:41:18 +02:00
klemek 321892bfac feat: add rrule start date
TS Lint / Oxlint (push) Has been cancelled
TS Lint / TypeScript (push) Has been cancelled
TS Lint / ESLint (push) Has been cancelled
Docker Build / build (push) Has been cancelled
2026-07-29 14:41:06 +02:00
klemek 7daa0802cc chore: 1.6.2
Docker Build / build (push) Successful in 8m12s
TS Lint / ESLint (push) Successful in 3m51s
TS Lint / Oxlint (push) Successful in 4m53s
TS Lint / TypeScript (push) Successful in 5m7s
Python Lint CI / ruff (push) Successful in 4m25s
Python Lint CI / ty (push) Successful in 3m58s
Python Lint CI / ruff-format-check (push) Successful in 4m0s
2026-07-29 09:45:37 +02:00
klemek 84c6359583 fix: responsive
Docker Build / build (push) Has been cancelled
TS Lint / ESLint (push) Has been cancelled
TS Lint / Oxlint (push) Has been cancelled
TS Lint / TypeScript (push) Has been cancelled
2026-07-29 09:45:20 +02:00
16 changed files with 178 additions and 89 deletions
+1
View File
@@ -1,5 +1,6 @@
{ {
"lockfileVersion": 1, "lockfileVersion": 1,
"configVersion": 0,
"workspaces": { "workspaces": {
"": { "": {
"name": "tout-doux", "name": "tout-doux",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "tout-doux", "name": "tout-doux",
"version": "1.6.1", "version": "1.7.3",
"private": true, "private": true,
"type": "module", "type": "module",
"engines": { "engines": {
+1 -1
View File
@@ -1,6 +1,6 @@
[project] [project]
name = "tout-doux" name = "tout-doux"
version = "1.6.1" version = "1.7.3"
description = "" description = ""
requires-python = ">=3.14" requires-python = ">=3.14"
dependencies = [ dependencies = [
+2 -1
View File
@@ -44,7 +44,8 @@
"October", "October",
"November", "November",
"December" "December"
] ],
"rrule_start": "Start:"
}, },
"checked": "Checked", "checked": "Checked",
"resets": "Resets", "resets": "Resets",
+2 -1
View File
@@ -44,7 +44,8 @@
"Octobre", "Octobre",
"Novembre", "Novembre",
"Décembre" "Décembre"
] ],
"rrule_start": "Début :"
}, },
"checked": "Complété", "checked": "Complété",
"resets": "Reviens", "resets": "Reviens",
+1 -1
View File
@@ -25,7 +25,7 @@ onMounted(() => {
<div class="hero bg-hero grow"> <div class="hero bg-hero grow">
<div class="hero-content text-center p-0"> <div class="hero-content text-center p-0">
<div <div
class="max-w-96 bg-base-100 rounded-box shadow-md p-4" class="max-w-96 min-w-screen sm:min-w-96 bg-base-100 rounded-box shadow-md p-4"
> >
<router-link <router-link
to="/" to="/"
+1 -4
View File
@@ -1,9 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { useAlertStore } from "@/stores/alerts"; import { useAlertStore } from "@/stores/alerts";
import { defineAsyncComponent } from "vue"; import AlertItem from "@/components/AlertItem.vue";
const AlertItem = defineAsyncComponent(
() => import("@/components/AlertItem.vue"),
);
const { alerts } = useAlertStore(); const { alerts } = useAlertStore();
</script> </script>
+61 -37
View File
@@ -2,6 +2,7 @@
import { ref, onBeforeMount, watch } from "vue"; import { ref, onBeforeMount, watch } from "vue";
import { getCron, parseCron, validCron } from "@/lib/recurrence"; import { getCron, parseCron, validCron } from "@/lib/recurrence";
import { CronType } from "@/enums"; import { CronType } from "@/enums";
import DateInput from "@/components/DateInput.vue";
const DEFAULT_CRON = "0 0 * * *"; const DEFAULT_CRON = "0 0 * * *";
@@ -11,23 +12,30 @@ const valid = ref<boolean>(true);
const props = defineProps<{ editMode: boolean }>(); const props = defineProps<{ editMode: boolean }>();
const cronType = ref<CronType>(CronType.MANUAL); const cronType = ref<CronType>(CronType.MANUAL);
const cronValue = ref<string>('0'); const cronValue = ref<string>("0");
const cronDate = ref<Date>(new Date());
function onCronChanged() { function onCronChanged() {
const data = parseCron(cron.value); const data = parseCron(cron.value);
rawCron.value = cron.value ?? DEFAULT_CRON; rawCron.value = cron.value ?? DEFAULT_CRON;
cronType.value = data.type; cronType.value = data.type;
cronValue.value = data.value.toFixed(0); cronValue.value = data.value.toFixed(0);
cronDate.value = data.date ?? new Date();
} }
function updateCron() { function updateCron() {
cron.value = getCron(cronType.value, parseInt(cronValue.value), rawCron.value); cron.value = getCron(
cronType.value,
parseInt(cronValue.value),
cronDate.value,
rawCron.value,
);
} }
function onChangeCronType() { function onChangeCronType() {
switch (cronType.value) { switch (cronType.value) {
case CronType.EVERY_DAY: case CronType.EVERY_DAY:
cronValue.value = '0'; cronValue.value = "0";
break; break;
case CronType.EVERY_WEEK: case CronType.EVERY_WEEK:
case CronType.EVERY_MONTH: case CronType.EVERY_MONTH:
@@ -35,7 +43,7 @@ function onChangeCronType() {
case CronType.EVERY_N_DAYS: case CronType.EVERY_N_DAYS:
case CronType.EVERY_N_WEEKS: case CronType.EVERY_N_WEEKS:
case CronType.EVERY_N_MONTHS: case CronType.EVERY_N_MONTHS:
cronValue.value = '1'; cronValue.value = "1";
break; break;
case CronType.CUSTOM: case CronType.CUSTOM:
cron.value ??= DEFAULT_CRON; cron.value ??= DEFAULT_CRON;
@@ -48,6 +56,10 @@ function onChangeCronValue() {
updateCron(); updateCron();
} }
function onChangeCronDate() {
updateCron();
}
function onInputRawCron() { function onInputRawCron() {
valid.value = validCron(rawCron.value); valid.value = validCron(rawCron.value);
if (valid.value) { if (valid.value) {
@@ -65,8 +77,12 @@ watch(cron, () => {
</script> </script>
<template> <template>
<div class="flex gap-2"> <div class="flex gap-2 flex-wrap">
<select v-model="cronType" class="select flex-1" @change="onChangeCronType"> <select
v-model="cronType"
class="select flex-1"
@change="onChangeCronType"
>
<option :value="CronType.MANUAL"> <option :value="CronType.MANUAL">
{{ $t("cron.type.manual") }} {{ $t("cron.type.manual") }}
</option> </option>
@@ -98,20 +114,6 @@ watch(cron, () => {
{{ $t("cron.type.one_time") }} {{ $t("cron.type.one_time") }}
</option> </option>
</select> </select>
<select
v-if="cronType === CronType.EVERY_DAY"
v-model="cronValue"
class="select flex-1"
@change="onChangeCronValue"
>
<option
v-for="i in Array.from(Array(24).keys())"
:key="`h${i+1}`"
:value="i"
>
{{ i.toFixed(0).padStart(2, "0") }}:00
</option>
</select>
<select <select
v-if="cronType === CronType.EVERY_WEEK" v-if="cronType === CronType.EVERY_WEEK"
v-model="cronValue" v-model="cronValue"
@@ -120,7 +122,7 @@ watch(cron, () => {
> >
<option <option
v-for="i in Array.from(Array(7).keys())" v-for="i in Array.from(Array(7).keys())"
:key="`w${i+1}`" :key="`w${i + 1}`"
:value="i + 1" :value="i + 1"
> >
{{ $t(`cron.week.${i.toFixed(0)}`) }} {{ $t(`cron.week.${i.toFixed(0)}`) }}
@@ -132,35 +134,37 @@ watch(cron, () => {
class="select flex-1" class="select flex-1"
@change="onChangeCronValue" @change="onChangeCronValue"
> >
<option :value="1">{{ $t('cron.month.first_day') }}</option> <option :value="1">{{ $t("cron.month.first_day") }}</option>
<option :value="32">{{ $t('cron.month.last_day') }}</option> <option :value="32">{{ $t("cron.month.last_day") }}</option>
<option <option
v-for="i in Array.from(Array(7).keys())" v-for="i in Array.from(Array(7).keys())"
:key="`d${-(i+1)}`" :key="`d${-(i + 1)}`"
:value="-(i + 1)" :value="-(i + 1)"
> >
{{ $t("cron.month.first") }} {{ $t(`cron.week.${i.toFixed(0)}`).toLowerCase() }} {{ $t("cron.month.first") }}
{{ $t(`cron.week.${i.toFixed(0)}`).toLowerCase() }}
</option> </option>
<option <option
v-for="i in Array.from(Array(7).keys())" v-for="i in Array.from(Array(7).keys())"
:key="`d${-(i+8)}`" :key="`d${-(i + 8)}`"
:value="-(i + 8)" :value="-(i + 8)"
> >
{{ $t("cron.month.last") }} {{ $t(`cron.week.${i.toFixed(0)}`).toLowerCase() }} {{ $t("cron.month.last") }}
{{ $t(`cron.week.${i.toFixed(0)}`).toLowerCase() }}
</option> </option>
<option <option
v-for="i in Array.from(Array(30).keys())" v-for="i in Array.from(Array(30).keys())"
:key="`d${i+2}`" :key="`d${i + 2}`"
:value="i + 2" :value="i + 2"
> >
{{ {{
(i % 10 == 9 && i !== 9) i % 10 == 9 && i !== 9
? $t("cron.month.st", [i+2]) ? $t("cron.month.st", [i + 2])
: (i % 10 === 0 && i !== 10) : i % 10 === 0 && i !== 10
? $t("cron.month.nd", [i+2]) ? $t("cron.month.nd", [i + 2])
: (i % 10 === 1 && i !== 11) : i % 10 === 1 && i !== 11
? $t("cron.month.rd", [i+2]) ? $t("cron.month.rd", [i + 2])
: $t("cron.month.th", [i+2]) : $t("cron.month.th", [i + 2])
}} }}
</option> </option>
</select> </select>
@@ -187,13 +191,33 @@ watch(cron, () => {
@input="onInputRawCron" @input="onInputRawCron"
/> />
<input <input
v-if="cronType === CronType.EVERY_N_DAYS || cronType === CronType.EVERY_N_WEEKS || cronType === CronType.EVERY_N_MONTHS" v-if="
cronType === CronType.EVERY_N_DAYS ||
cronType === CronType.EVERY_N_WEEKS ||
cronType === CronType.EVERY_N_MONTHS
"
v-model="cronValue" v-model="cronValue"
type="number" type="number"
min="1" min="1"
step="1" step="1"
class="input font-mono flex-1" class="input font-mono flex-1"
@input="onChangeCronValue" @change="onChangeCronValue"
/> />
<label
v-if="
cronType === CronType.EVERY_N_DAYS ||
cronType === CronType.EVERY_N_WEEKS ||
cronType === CronType.EVERY_N_MONTHS
"
class="label flex-1 basis-full"
>
{{ $t("cron.rrule_start") }}
<date-input
v-model="cronDate"
required
class="input font-mono"
@change="onChangeCronDate"
/>
</label>
</div> </div>
</template> </template>
+26
View File
@@ -0,0 +1,26 @@
<script setup lang="ts">
const emit = defineEmits<(e: "input"|"change", value: Date) => void>();
const date = defineModel<Date>({ required: true });
function onInput(event: Event) {
const inputValue = (event.target as HTMLInputElement).value;
date.value = new Date(inputValue);
emit('input', date.value);
}
function onChange(event: Event) {
const inputValue = (event.target as HTMLInputElement).value;
date.value = new Date(inputValue);
emit('change', date.value);
}
</script>
<template>
<input
:value="date.toISOString().substring(0, 10)"
type="date"
@input="onInput"
@change="onChange"
/>
</template>
+7 -11
View File
@@ -1,20 +1,16 @@
<script setup lang="ts"> <script setup lang="ts">
import { getMetadata } from "@/api/meta"; import { getMetadata } from "@/api/meta";
import type { Metadata } from "@/types"; import type { Metadata } from "@/types";
import { defineAsyncComponent, onBeforeMount, ref } from "vue"; import { onBeforeMount, ref } from "vue";
import LangInput from "@/components/LangInput.vue";
const metadata = ref<Metadata|null>(null); const metadata = ref<Metadata | null>(null);
const LangInput = defineAsyncComponent(
() => import("@/components/LangInput.vue"),
);
function fetchMetadata() { function fetchMetadata() {
void getMetadata() void getMetadata().then((data) => {
.then((data) => { metadata.value = data;
metadata.value = data; setTimeout(fetchMetadata, 600000);
setTimeout(fetchMetadata, 600000); });
});
} }
onBeforeMount(fetchMetadata); onBeforeMount(fetchMetadata);
+1 -4
View File
@@ -4,15 +4,12 @@ import {
ref, ref,
watch, watch,
computed, computed,
defineAsyncComponent,
nextTick, nextTick,
} from "vue"; } from "vue";
import type { Task } from "@/types"; import type { Task } from "@/types";
import { CopyIcon, TrashIcon, SaveIcon, XIcon } from "@lucide/vue"; import { CopyIcon, TrashIcon, SaveIcon, XIcon } from "@lucide/vue";
import { updateTask } from "@/api/tasks"; import { updateTask } from "@/api/tasks";
const CronInput = defineAsyncComponent( import CronInput from "@/components/CronInput.vue";
() => import("@/components/CronInput.vue"),
);
import { import {
isTemporary, isTemporary,
taskCompleted, taskCompleted,
+38 -9
View File
@@ -7,59 +7,70 @@ const ONE_TIME_VALUE = "@one-time";
export function parseCron(cron: string | null): { export function parseCron(cron: string | null): {
type: CronType; type: CronType;
value: number; value: number;
date: Date | null;
} { } {
let value: RegExpMatchArray | null; let value: RegExpMatchArray | null;
if (cron === null) { if (cron === null) {
return { return {
type: CronType.MANUAL, type: CronType.MANUAL,
value: 0, value: 0,
date: null,
}; };
} else if (cron === ONE_TIME_VALUE) { } else if (cron === ONE_TIME_VALUE) {
return { return {
type: CronType.ONE_TIME, type: CronType.ONE_TIME,
value: 0, value: 0,
date: null,
}; };
} else if (cron.startsWith("RRULE:")) { } else if (cron.startsWith("RRULE:") || cron.startsWith("DTSTART:")) {
return parseRrule(cron); return parseRrule(cron);
} else if ((value = /^0 (\d+) \* \* \*$/i.exec(cron)) !== null) { } else if ((value = /^0 (\d+) \* \* \*$/i.exec(cron)) !== null) {
return { return {
type: CronType.EVERY_DAY, type: CronType.EVERY_DAY,
value: parseInt(value[1] ?? ""), value: parseInt(value[1] ?? ""),
date: null,
}; };
} else if ((value = /^0 0 \* \* (\d+)$/i.exec(cron)) !== null) { } else if ((value = /^0 0 \* \* (\d+)$/i.exec(cron)) !== null) {
return { return {
type: CronType.EVERY_WEEK, type: CronType.EVERY_WEEK,
value: parseInt(value[1] ?? ""), value: parseInt(value[1] ?? ""),
date: null,
}; };
} else if ((value = /^0 0 (\d+) \* \*$/i.exec(cron)) !== null) { } else if ((value = /^0 0 (\d+) \* \*$/i.exec(cron)) !== null) {
return { return {
type: CronType.EVERY_MONTH, type: CronType.EVERY_MONTH,
value: parseInt(value[1] ?? ""), value: parseInt(value[1] ?? ""),
date: null,
}; };
} else if ((value = /^0 0 L \* \*$/i.exec(cron)) !== null) { } else if ((value = /^0 0 L \* \*$/i.exec(cron)) !== null) {
return { return {
type: CronType.EVERY_MONTH, type: CronType.EVERY_MONTH,
value: 32, value: 32,
date: null,
}; };
} else if ((value = /^0 0 \* \* (\d+)#1$/i.exec(cron)) !== null) { } else if ((value = /^0 0 \* \* (\d+)#1$/i.exec(cron)) !== null) {
return { return {
type: CronType.EVERY_MONTH, type: CronType.EVERY_MONTH,
value: -parseInt(value[1] ?? ""), value: -parseInt(value[1] ?? ""),
date: null,
}; };
} else if ((value = /^0 0 \* \* (\d+)L$/i.exec(cron)) !== null) { } else if ((value = /^0 0 \* \* (\d+)L$/i.exec(cron)) !== null) {
return { return {
type: CronType.EVERY_MONTH, type: CronType.EVERY_MONTH,
value: -parseInt(value[1] ?? "") - 7, value: -parseInt(value[1] ?? "") - 7,
date: null,
}; };
} else if ((value = /^0 0 1 (\d+) \*$/i.exec(cron)) !== null) { } else if ((value = /^0 0 1 (\d+) \*$/i.exec(cron)) !== null) {
return { return {
type: CronType.EVERY_YEAR, type: CronType.EVERY_YEAR,
value: parseInt(value[1] ?? ""), value: parseInt(value[1] ?? ""),
date: null,
}; };
} else { } else {
return { return {
type: CronType.CUSTOM, type: CronType.CUSTOM,
value: 0, value: 0,
date: null,
}; };
} }
} }
@@ -67,6 +78,7 @@ export function parseCron(cron: string | null): {
export function parseRrule(rule: string): { export function parseRrule(rule: string): {
type: CronType; type: CronType;
value: number; value: number;
date: Date | null;
} { } {
try { try {
const rrule = RRule.parseString(rule); const rrule = RRule.parseString(rule);
@@ -75,21 +87,25 @@ export function parseRrule(rule: string): {
return { return {
type: CronType.EVERY_N_MONTHS, type: CronType.EVERY_N_MONTHS,
value: (rrule.interval ?? 1) * 12, value: (rrule.interval ?? 1) * 12,
date: rrule.dtstart ?? null,
}; };
case RRule.MONTHLY: case RRule.MONTHLY:
return { return {
type: CronType.EVERY_N_MONTHS, type: CronType.EVERY_N_MONTHS,
value: rrule.interval ?? 1, value: rrule.interval ?? 1,
date: rrule.dtstart ?? null,
}; };
case RRule.WEEKLY: case RRule.WEEKLY:
return { return {
type: CronType.EVERY_N_WEEKS, type: CronType.EVERY_N_WEEKS,
value: rrule.interval ?? 1, value: rrule.interval ?? 1,
date: rrule.dtstart ?? null,
}; };
case RRule.DAILY: case RRule.DAILY:
return { return {
type: CronType.EVERY_N_DAYS, type: CronType.EVERY_N_DAYS,
value: rrule.interval ?? 1, value: rrule.interval ?? 1,
date: rrule.dtstart ?? null,
}; };
} }
} catch { } catch {
@@ -98,19 +114,21 @@ export function parseRrule(rule: string): {
return { return {
type: CronType.MANUAL, type: CronType.MANUAL,
value: 0, value: 0,
date: null,
}; };
} }
export function getCron( export function getCron(
type: CronType, type: CronType,
value: number, value: number,
date: Date,
fallback: string, fallback: string,
): string | null { ): string | null {
switch (type) { switch (type) {
case CronType.ONE_TIME: case CronType.ONE_TIME:
return ONE_TIME_VALUE; return ONE_TIME_VALUE;
case CronType.EVERY_DAY: case CronType.EVERY_DAY:
return `0 ${value.toFixed(0)} * * *`; return `0 0 * * *`;
case CronType.EVERY_WEEK: case CronType.EVERY_WEEK:
return `0 0 * * ${value.toFixed(0)}`; return `0 0 * * ${value.toFixed(0)}`;
case CronType.EVERY_MONTH: case CronType.EVERY_MONTH:
@@ -127,11 +145,23 @@ export function getCron(
case CronType.EVERY_YEAR: case CronType.EVERY_YEAR:
return `0 0 1 ${value.toFixed(0)} *`; return `0 0 1 ${value.toFixed(0)} *`;
case CronType.EVERY_N_MONTHS: case CronType.EVERY_N_MONTHS:
return `RRULE:FREQ=MONTHLY;INTERVAL=${value.toFixed(0)}`; return new RRule({
freq: RRule.MONTHLY,
interval: value,
dtstart: date,
}).toString();
case CronType.EVERY_N_WEEKS: case CronType.EVERY_N_WEEKS:
return `RRULE:FREQ=WEEKLY;INTERVAL=${value.toFixed(0)}`; return new RRule({
freq: RRule.WEEKLY,
interval: value,
dtstart: date,
}).toString();
case CronType.EVERY_N_DAYS: case CronType.EVERY_N_DAYS:
return `RRULE:FREQ=DAILY;INTERVAL=${value.toFixed(0)}`; return new RRule({
freq: RRule.DAILY,
interval: value,
dtstart: date,
}).toString();
case CronType.CUSTOM: case CronType.CUSTOM:
if (validCron(fallback)) { if (validCron(fallback)) {
return fallback; return fallback;
@@ -155,11 +185,11 @@ export function validCron(cron: string): boolean {
} }
export function nextCronReset( export function nextCronReset(
date: Date | null, date: Date,
cron: string | null, cron: string | null,
hash: string, hash: string,
): Date | null { ): Date | null {
if (date === null || cron === null || isOneTime(cron)) { if (cron === null || isOneTime(cron)) {
return null; return null;
} }
try { try {
@@ -167,11 +197,10 @@ export function nextCronReset(
try { try {
const rule = new RRule({ const rule = new RRule({
...RRule.parseString(cron), ...RRule.parseString(cron),
dtstart: date,
count: 2, count: 2,
}); });
return rule.all()[1] ?? null; return rule.after(date) ?? null;
} catch { } catch {
// ignore // ignore
} }
+30 -7
View File
@@ -35,21 +35,44 @@ export function isTemporary(task: Task): boolean {
} }
export function taskNextReset(task: Task): Date | null { export function taskNextReset(task: Task): Date | null {
return nextCronReset(task.check_date, task.reset_cron, task.id); return nextCronReset(
task.check_date ?? new Date(),
task.reset_cron,
task.id,
);
} }
export function taskFutureReset(task: Task): Date | null { export function taskFutureReset(task: Task): Date | null {
return nextCronReset(taskNextReset(task), task.reset_cron, task.id); return nextCronReset(
taskNextReset(task) ?? new Date(),
task.reset_cron,
task.id,
);
} }
export function taskCompleted(task: Task): boolean { export function taskCompleted(task: Task): boolean {
if (task.check_date === null) {
return false;
}
const nextReset = taskNextReset(task); const nextReset = taskNextReset(task);
if (nextReset === null) { if (nextReset === null) {
return task.check_date !== null; return true;
} }
return nextReset.getTime() > new Date().getTime(); return nextReset.getTime() > new Date().getTime();
} }
export function fallbackDate(task: Task): Date {
return new Date(
task.created_at.getFullYear() - 100,
task.created_at.getMonth(),
task.created_at.getDate(),
0,
0,
0,
0,
);
}
export function sortTasks( export function sortTasks(
tasks: Task[], tasks: Task[],
sortType: SortType, sortType: SortType,
@@ -78,8 +101,8 @@ export function sortTasks(
.sort( .sort(
(a: Task, b: Task) => (a: Task, b: Task) =>
(reverse ? -1 : 1) * (reverse ? -1 : 1) *
((a.check_date ?? a.created_at).getTime() - ((a.check_date ?? fallbackDate(a)).getTime() -
(b.check_date ?? b.created_at).getTime()), (b.check_date ?? fallbackDate(b)).getTime()),
); );
case SortType.RESET_DATE: case SortType.RESET_DATE:
return tasks return tasks
@@ -87,8 +110,8 @@ export function sortTasks(
.sort( .sort(
(a: Task, b: Task) => (a: Task, b: Task) =>
(reverse ? -1 : 1) * (reverse ? -1 : 1) *
(taskNextReset(a) ?? a.created_at).getTime() - (taskNextReset(a) ?? fallbackDate(a)).getTime() -
(taskNextReset(b) ?? b.created_at).getTime(), (taskNextReset(b) ?? fallbackDate(b)).getTime(),
); );
case SortType.NAME: case SortType.NAME:
return tasks return tasks
+2 -4
View File
@@ -2,11 +2,9 @@
import { useListStore } from "@/stores/lists"; import { useListStore } from "@/stores/lists";
import { ArrowBigRightDashIcon, DicesIcon, HistoryIcon } from "@lucide/vue"; import { ArrowBigRightDashIcon, DicesIcon, HistoryIcon } from "@lucide/vue";
import { generateSlug } from "random-word-slugs"; import { generateSlug } from "random-word-slugs";
import { defineAsyncComponent, onBeforeMount, ref } from "vue"; import { onBeforeMount, ref } from "vue";
import { onBeforeRouteUpdate } from "vue-router"; import { onBeforeRouteUpdate } from "vue-router";
const RecentItem = defineAsyncComponent( import RecentItem from "@/components/RecentItem.vue";
() => import("@/components/RecentItem.vue"),
);
const listNameInput = ref<string>(generateSlug(4)); const listNameInput = ref<string>(generateSlug(4));
+3 -7
View File
@@ -1,5 +1,5 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onBeforeMount, computed, defineAsyncComponent } from "vue"; import { ref, onBeforeMount, computed } from "vue";
import type { Task } from "@/types"; import type { Task } from "@/types";
import { getTasks, createTask, deleteTask } from "@/api/tasks"; import { getTasks, createTask, deleteTask } from "@/api/tasks";
import { import {
@@ -9,12 +9,8 @@ import {
SearchIcon, SearchIcon,
Share2Icon, Share2Icon,
} from "@lucide/vue"; } from "@lucide/vue";
const TaskItem = defineAsyncComponent( import TaskItem from "@/components/TaskItem.vue";
() => import("@/components/TaskItem.vue"), import ListOptions from "@/components/ListOptions.vue";
);
const ListOptions = defineAsyncComponent(
() => import("@/components/ListOptions.vue"),
);
import { taskCompleted, sortTasks, newTemporaryTask } from "@/lib/tasks"; import { taskCompleted, sortTasks, newTemporaryTask } from "@/lib/tasks";
import { SortType } from "@/enums"; import { SortType } from "@/enums";
import { booleanCookieRef, enumCookieRef } from "@/lib/cookies"; import { booleanCookieRef, enumCookieRef } from "@/lib/cookies";
Generated
+1 -1
View File
@@ -323,7 +323,7 @@ asyncpg = [
[[package]] [[package]]
name = "tout-doux" name = "tout-doux"
version = "1.6.1" version = "1.7.3"
source = { editable = "." } source = { editable = "." }
dependencies = [ dependencies = [
{ name = "flask", extra = ["async"] }, { name = "flask", extra = ["async"] },