Skip to content

Commit

Permalink
fix(time): add a delay before recalculating the time with the step #2282
Browse files Browse the repository at this point in the history
Approved-by: VANDERHAGHEN Luc <[email protected]>
  • Loading branch information
LeonDumestre committed Dec 26, 2024
1 parent 75e5808 commit 3c5c336
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 12 deletions.
11 changes: 8 additions & 3 deletions apps/web/components/atoms/field/date/DateTimeField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,15 @@ watch(
);
const emit = defineEmits(["update:model-value", "enter"]);
const delay = ref<ReturnType<typeof setTimeout> | undefined>();
const updateDate = (date: string) => {
const fixedDate = OverDate.fromLocal(new Date(date)).date;
const roundedMinutes = roundMinutes(fixedDate, step);
emit("update:model-value", roundedMinutes);
if (delay.value) clearInterval(delay.value);
delay.value = setTimeout(() => {
const fixedDate = OverDate.fromLocal(new Date(date)).date;
const roundedMinutes = roundMinutes(fixedDate, step);
emit("update:model-value", roundedMinutes);
}, 500);
};
const enterKeyDown = () => emit("enter");
</script>
2 changes: 1 addition & 1 deletion apps/web/components/molecules/logistic/GearFilter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const team = defineModel<Team | undefined>("team", { required: true });
const updateSearch = (value: string | null) =>
emit("update:search", value ?? "");
const delay = ref<ReturnType<typeof setTimeout> | undefined>(undefined);
const delay = ref<ReturnType<typeof setTimeout> | undefined>();
const defectSearchUpdate = (search: string) => {
if (delay.value) clearInterval(delay.value);
delay.value = setTimeout(() => updateSearch(search), 800);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const addNewBarrel = async () => {
price.value = 100;
openedOn.value = new Date();
};
const delay = ref<ReturnType<typeof setTimeout> | undefined>(undefined);
const delay = ref<ReturnType<typeof setTimeout> | undefined>();
const adjustBarrelPrice = (slug: string, price: number) => {
if (delay.value) clearInterval(delay.value);
delay.value = setTimeout(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<v-card-subtitle>
Si tu as des questions sur les besoins ou le nom d'un dispositif de sécu
de ton activité, contacte
<a :href="`mailto:${SECURITE_EMAIL}`">{{ SECURITE_EMAIL }}</a>.
<a :href="`mailto:${SECURITE_EMAIL}`">{{ SECURITE_EMAIL }} </a>.
</v-card-subtitle>
<v-card-text>
<v-textarea
Expand Down Expand Up @@ -46,7 +46,7 @@ const security = computed<FestivalActivity["security"]>(
() => selectedActivity.value.security,
);
const delay = ref<ReturnType<typeof setTimeout> | undefined>(undefined);
const delay = ref<ReturnType<typeof setTimeout> | undefined>();
const updateSpecialNeed = (canBeEmpty: string) => {
if (delay.value) clearInterval(delay.value);
const specialNeed = canBeEmpty.trim() || null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const removeElectricitySupply = (supply: ElectricitySupply) => {
faStore.removeElectricitySupply(supply.id);
};
const delay = ref<ReturnType<typeof setTimeout> | undefined>(undefined);
const delay = ref<ReturnType<typeof setTimeout> | undefined>();
const updateWaterSupply = (canBeEmpty: string) => {
if (delay.value) clearInterval(delay.value);
const water = canBeEmpty.trim() ? canBeEmpty : null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const inChargeTeam = computed<Team | undefined>(() =>
teamStore.getTeamByCode(general.value.team ?? ""),
);
const delay = ref<ReturnType<typeof setTimeout> | undefined>(undefined);
const delay = ref<ReturnType<typeof setTimeout> | undefined>();
const updateName = (name: string) => {
if (delay.value) clearInterval(delay.value);
delay.value = setTimeout(() => ftStore.updateGeneral({ name }), 800);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ watch(isResetApprovalsDialogOpen, (value: boolean) => {
const updateAppointment = (appointmentId?: SignaLocation["id"]) => {
ftStore.updateInstructions({ appointmentId });
};
const delay = ref<ReturnType<typeof setTimeout> | undefined>(undefined);
const delay = ref<ReturnType<typeof setTimeout> | undefined>();
const updateGlobal = (canBeEmpty: string) => {
openResetApprovalsDialogIfNeeded();
if (delay.value) clearInterval(delay.value);
Expand Down
2 changes: 1 addition & 1 deletion apps/web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@overbookd/web",
"version": "3.3.58",
"version": "3.3.59",
"description": "Application web pour le logiciel de gestion du festival des 24 heures de l'INSA",
"author": "Club des 24 heures de l'INSA (https://www.24heures.org/)",
"homepage": "https://gitlab.com/24-heures-insa/overbookd-mono",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "overbookd",
"version": "3.21.2-rc.5",
"version": "3.21.2-rc.6",
"main": "index.js",
"keywords": [],
"license": "Apache-2.0",
Expand Down

0 comments on commit 3c5c336

Please sign in to comment.