feat: delete
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user