improving-week-36 #1

Merged
jare2473 merged 41 commits from improving-week-36 into main 2025-09-04 10:49:05 +02:00
2 changed files with 5 additions and 5 deletions
Showing only changes of commit 9118cf11be - Show all commits

View File

@@ -26,7 +26,7 @@ export const SettingsProvider = ({ children }) => {
roomAvailabilityChance: 0.7,
numberOfRooms: 5,
earliestTimeSlot: 0,
latestTimeSlot: 22,
latestTimeSlot: 23,
currentUserName: USER.name,
// Then override with saved values
...parsed,
@@ -52,7 +52,7 @@ export const SettingsProvider = ({ children }) => {
// Earliest booking time (in half-hour slots from 8:00)
earliestTimeSlot: 0, // 8:00
// Latest booking time
latestTimeSlot: 22, // 19:00 (last slot ending at 19:30)
latestTimeSlot: 23, // 19:30 (last slot ending at 20:00)
// Current user settings
currentUserName: USER.name,
};
@@ -93,7 +93,7 @@ export const SettingsProvider = ({ children }) => {
roomAvailabilityChance: 0.7,
numberOfRooms: 5,
earliestTimeSlot: 0,
latestTimeSlot: 22,
latestTimeSlot: 23,
currentUserName: USER.name,
});
localStorage.removeItem('calendarSettings');

View File

@@ -1,10 +1,10 @@
import { today, getLocalTimeZone } from '@internationalized/date';
import { NUMBER_OF_ROOMS, CHANCE_OF_AVAILABILITY } from '../constants/bookingConstants';
export const generateInitialRooms = (chanceOfAvailability = CHANCE_OF_AVAILABILITY, numberOfRooms = NUMBER_OF_ROOMS, earliestSlot = 0, latestSlot = 22) => {
export const generateInitialRooms = (chanceOfAvailability = CHANCE_OF_AVAILABILITY, numberOfRooms = NUMBER_OF_ROOMS, earliestSlot = 0, latestSlot = 23) => {
return [...Array(numberOfRooms)].map((room, index) => ({
roomId: `G5:${index + 1}`,
times: Array.from({ length: 23 }, (_, i) => ({
times: Array.from({ length: 24 }, (_, i) => ({
available: i >= earliestSlot && i <= latestSlot ?
(Math.random() < chanceOfAvailability) : false
}))