From 7035daef181ba78b0c4f70f9f5156b97be27ae1c Mon Sep 17 00:00:00 2001
From: "riho.takagi" Room Reservation Request
Details diff --git a/media_commons_booking_app/src/client/booking/components/Calendars.tsx b/media_commons_booking_app/src/client/booking/components/Calendars.tsx index 4aefb955..59f66621 100644 --- a/media_commons_booking_app/src/client/booking/components/Calendars.tsx +++ b/media_commons_booking_app/src/client/booking/components/Calendars.tsx @@ -132,7 +132,7 @@ export const Calendars = ({ // only enrolledThesis user can book over 4 hours if ( !enrolledThisis && - selectInfo.end.getTime() / 1000 - selectInfo.start.getTime() / 1000 >= + selectInfo.end.getTime() / 1000 - selectInfo.start.getTime() / 1000 > 60 * 60 * 4 ) { return false; diff --git a/media_commons_booking_app/src/client/booking/components/MultipleCalendars.tsx b/media_commons_booking_app/src/client/booking/components/MultipleCalendars.tsx index 4f3c03ea..cca5e93e 100644 --- a/media_commons_booking_app/src/client/booking/components/MultipleCalendars.tsx +++ b/media_commons_booking_app/src/client/booking/components/MultipleCalendars.tsx @@ -25,13 +25,6 @@ export const MultipleCalendars = ({ apiKey, allRooms, handleSetDate }) => { checkedRoomIds.includes(room.roomId) ); setCheckedRooms(checked); - if ( - checkedRoomIds.includes('221') || - (checkedRoomIds.includes('222') && !showMotionCaptureModal) - ) { - setShowMotionCaptureModal(true); - setHasModalBeenShown(true); - } }, [checkedRoomIds]); if (loading) { @@ -42,6 +35,15 @@ export const MultipleCalendars = ({ apiKey, allRooms, handleSetDate }) => { const { value, checked } = event.target; const valuesArray = value.split(','); + console.log('value', value); + + if ( + !hasModalBeenShown && + (valuesArray.includes('221') || valuesArray.includes('222')) + ) { + setShowMotionCaptureModal(true); + setHasModalBeenShown(true); + } if (checked) { setCheckedRoomIds((prev) => [...prev, ...valuesArray]); diff --git a/media_commons_booking_app/src/server/sheets.js b/media_commons_booking_app/src/server/sheets.js index d17df7c3..d8232b27 100644 --- a/media_commons_booking_app/src/server/sheets.js +++ b/media_commons_booking_app/src/server/sheets.js @@ -1,8 +1,4 @@ -const getSheets = () => SpreadsheetApp.getActive().getSheets(); - -const getActiveSheetName = () => SpreadsheetApp.getActive().getSheetName(); - -const ACTIVE_SHEET_ID = '1VZ-DY6o0GM5DL-v9AKkpCbF0w-xm-_T-vVUSPZph06Q'; +const ACTIVE_SHEET_ID = '1MnWbn6bvNyMiawddtYYx0tRW4NMgvugl0I8zBO3sy68'; export const fetchRows_ = (sheetName) => { return SpreadsheetApp.openById(ACTIVE_SHEET_ID) @@ -22,7 +18,7 @@ export const fetchRows = (sheetName) => { function fetchById(sheetName, id) { const row = fetchRows_(sheetName).find((row) => row[0] === id); - if (!row) throw 'Invalid conversation ID: ' + id; + if (!row) throw `Invalid conversation ID: ${id}`; const messages = fetchRows_(sheetName) .filter((row) => row[0] === id) .flatMap((row) => { @@ -76,7 +72,7 @@ export const addEventToCalendar = ( new Date(startTime), new Date(endTime), { - description: description, + description, } ); event.setColor(CalendarApp.EventColor.GRAY); @@ -127,13 +123,13 @@ export const sendHTMLEmail = ( body ) => { console.log('contents', contents); - var htmlTemplate = HtmlService.createTemplateFromFile(templateName); - for (var key in contents) { + const htmlTemplate = HtmlService.createTemplateFromFile(templateName); + for (const key in contents) { htmlTemplate[key] = contents[key] || ''; } - var htmlBody = htmlTemplate.evaluate().getContent(); - var options = { - htmlBody: htmlBody, + const htmlBody = htmlTemplate.evaluate().getContent(); + const options = { + htmlBody, }; GmailApp.sendEmail(targetEmail, title, body, options); };