feat: delete

This commit is contained in:
Barf-Vader
2025-06-16 22:40:54 +01:00
parent 9306b42098
commit 0239f86985
3 changed files with 32 additions and 3 deletions

View File

@@ -14,7 +14,8 @@
volumeTags,
gmapsLoader,
daysOfWeek,
timeToMins
timeToMins,
collectTimings
} from "$lib";
import { onMount } from "svelte";
import type { Json } from "$lib/database.js";
@@ -61,6 +62,19 @@
function checkTimings() {
let cannotExist = [] as number[];
let hasAllDays = Object.values(collectTimings(studySpaceData.opening_times)).every(
(item) => !(Array.isArray(item) && item.length === 0)
);
if (
(allDays.closes_at === "" || allDays.opens_at === "") &&
allDays.open_today_status === null &&
!hasAllDays
) {
alert(`No opening time provided for all other days.`);
return false;
}
const opensAtMinsAll = timeToMins(allDays.opens_at);
const closesAtMinsAll = timeToMins(allDays.closes_at);
if (opensAtMinsAll >= closesAtMinsAll) {
@@ -200,6 +214,7 @@
// Nothing is provided
if (
(allDays.closes_at != "" && allDays.opens_at != "") ||
studySpaceData.opening_times.length === 7 ||
allDays.open_today_status != null
) {
const { error: hoursErr } = await supabase