@@ -6,18 +6,18 @@ const dayjs = require('dayjs');
66const weighted = require ( 'weighted' ) ;
77const config = require ( '../../config' ) ;
88
9- const determineServiceType = ( location , breastScreeningUnit ) => {
9+ const determineclinicType = ( location , breastScreeningUnit ) => {
1010 // First check location-specific service types
11- const serviceTypes = location . serviceTypes || breastScreeningUnit . serviceTypes ;
11+ const clinicTypes = location . clinicTypes || breastScreeningUnit . clinicTypes ;
1212
1313 // If still no service types, default to screening
14- if ( ! serviceTypes ) {
14+ if ( ! clinicTypes ) {
1515 return 'screening' ;
1616 }
1717
1818 // If location/BSU only supports one service type, use that
19- if ( serviceTypes . length === 1 ) {
20- return serviceTypes [ 0 ] ;
19+ if ( clinicTypes . length === 1 ) {
20+ return clinicTypes [ 0 ] ;
2121 }
2222
2323 // For locations that can do both, weight towards screening
@@ -27,7 +27,7 @@ const determineServiceType = (location, breastScreeningUnit) => {
2727 } ) ;
2828} ;
2929
30- const generateTimeSlots = ( date , sessionTimes , serviceType ) => {
30+ const generateTimeSlots = ( date , sessionTimes , clinicType ) => {
3131 const { slotDurationMinutes } = config . clinics ;
3232
3333 const slots = [ ] ;
@@ -40,8 +40,8 @@ const generateTimeSlots = (date, sessionTimes, serviceType) => {
4040 slots . push ( {
4141 id : slotId ,
4242 dateTime : new Date ( currentTime ) . toISOString ( ) ,
43- type : serviceType , // Use the clinic's service type
44- capacity : serviceType === 'assessment' ? 1 : 2 , // Assessment clinics don't double book
43+ type : clinicType , // Use the clinic's service type
44+ capacity : clinicType === 'assessment' ? 1 : 2 , // Assessment clinics don't double book
4545 bookedCount : 0 ,
4646 period : `${ sessionTimes . startTime } -${ sessionTimes . endTime } `
4747 } ) ;
@@ -87,15 +87,15 @@ const determineSessionType = (sessionTimes) => {
8787} ;
8888
8989const generateClinic = ( date , location , breastScreeningUnit , sessionTimes ) => {
90- const serviceType = determineServiceType ( location , breastScreeningUnit ) ;
91- const slots = generateTimeSlots ( date , sessionTimes , serviceType ) ;
90+ const clinicType = determineclinicType ( location , breastScreeningUnit ) ;
91+ const slots = generateTimeSlots ( date , sessionTimes , clinicType ) ;
9292
9393 return {
9494 id : generateId ( ) ,
9595 date : date . toISOString ( ) . split ( 'T' ) [ 0 ] ,
9696 breastScreeningUnitId : breastScreeningUnit . id ,
97- clinicType : location . type ,
98- serviceType ,
97+ locationType : location . type ,
98+ clinicType ,
9999 locationId : location . id ,
100100 siteName : location . type === 'mobile_unit' ? generateMobileSiteName ( ) : null ,
101101 slots,
@@ -106,9 +106,9 @@ const generateClinic = (date, location, breastScreeningUnit, sessionTimes) => {
106106 support : [ ]
107107 } ,
108108 targetCapacity : {
109- bookingPercent : serviceType === 'assessment' ? 100 : config . clinics . targetBookingPercent ,
110- attendancePercent : serviceType === 'assessment' ? 95 : config . clinics . targetAttendancePercent ,
111- totalSlots : slots . length * ( serviceType === 'assessment' ? 1 : 2 )
109+ bookingPercent : clinicType === 'assessment' ? 100 : config . clinics . targetBookingPercent ,
110+ attendancePercent : clinicType === 'assessment' ? 95 : config . clinics . targetAttendancePercent ,
111+ totalSlots : slots . length * ( clinicType === 'assessment' ? 1 : 2 )
112112 } ,
113113 notes : null ,
114114 sessionTimes,
0 commit comments