improving-week-36 #1
@@ -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');
|
||||
|
||||
@@ -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
|
||||
}))
|
||||
|
||||
Reference in New Issue
Block a user