fix(task): remove wrong repeat types

Repeating "monthly" or "yearly" was never what people expected, only 30 or 365 days which is not always correct. This change removes these settings since the repeating modes will be re-done anyway.

Related to vikunja/frontend#3585 (comment)
This commit is contained in:
kolaente 2023-09-06 15:41:48 +02:00
parent b187e8c1b6
commit 7746d39161
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B
4 changed files with 3 additions and 15 deletions

View File

@ -7,8 +7,8 @@
<x-button variant="secondary" class="is-small" @click="() => setRepeatAfter(1, 'weeks')">
{{ $t('task.repeat.everyWeek') }}
</x-button>
<x-button variant="secondary" class="is-small" @click="() => setRepeatAfter(1, 'months')">
{{ $t('task.repeat.everyMonth') }}
<x-button variant="secondary" class="is-small" @click="() => setRepeatAfter(30, 'days')">
{{ $t('task.repeat.every30d') }}
</x-button>
</div>
<div class="is-flex is-align-items-center mb-2">
@ -51,8 +51,6 @@
<option value="hours">{{ $t('task.repeat.hours') }}</option>
<option value="days">{{ $t('task.repeat.days') }}</option>
<option value="weeks">{{ $t('task.repeat.weeks') }}</option>
<option value="months">{{ $t('task.repeat.months') }}</option>
<option value="years">{{ $t('task.repeat.years') }}</option>
</select>
</div>
</div>

View File

@ -16,10 +16,6 @@ export function secondsToPeriod(seconds: number): { unit: PeriodUnit, amount: nu
if (seconds % SECONDS_A_DAY === 0) {
if (seconds % SECONDS_A_WEEK === 0) {
return {unit: 'weeks', amount: seconds / SECONDS_A_WEEK}
} else if (seconds % SECONDS_A_MONTH === 0) {
return {unit: 'days', amount: seconds / SECONDS_A_MONTH * 30}
} else if (seconds % SECONDS_A_YEAR === 0) {
return {unit: 'years', amount: seconds / SECONDS_A_YEAR}
} else {
return {unit: 'days', amount: seconds / SECONDS_A_DAY}
}

View File

@ -770,7 +770,7 @@
"repeat": {
"everyDay": "Every Day",
"everyWeek": "Every Week",
"everyMonth": "Every Month",
"every30d": "Every 30 Days",
"mode": "Repeat mode",
"monthly": "Monthly",
"fromCurrentDate": "From Current Date",

View File

@ -81,12 +81,6 @@ export default class TaskService extends AbstractService<ITask> {
case 'weeks':
repeatAfterSeconds = model.repeatAfter.amount * SECONDS_A_WEEK
break
case 'months':
repeatAfterSeconds = model.repeatAfter.amount * SECONDS_A_MONTH
break
case 'years':
repeatAfterSeconds = model.repeatAfter.amount * SECONDS_A_YEAR
break
}
}
model.repeatAfter = repeatAfterSeconds