diff --git a/lambda/export/constants.js b/lambda/export/constants.js index 93b06a5..6d32ef7 100644 --- a/lambda/export/constants.js +++ b/lambda/export/constants.js @@ -200,6 +200,12 @@ const CSV_SYSADMIN_SCHEMA = [ width: 63, value: (report) => report.totalAttendanceParties, }, + { + column: "Frontcountry Cabins - Parties - Total Attendance", + type: Number, + width: 63, + value: (report) => report.calc_frontcountryCabins_parties_totalAttendance, + }, // Frontcountry Cabins - Camping { column: "Frontcountry Cabins - Camping - Gross camping revenue", diff --git a/lambda/export/invokable/index.js b/lambda/export/invokable/index.js index 4c7ceb0..cd5a1d6 100644 --- a/lambda/export/invokable/index.js +++ b/lambda/export/invokable/index.js @@ -15,6 +15,7 @@ const { basicNetRevenue, frontcountryCampingPartyAttendance, frontcountryCampingSecondCarAttendance, + frontcountryCabinsPartiesAttendance, groupCampingStandardAttendance, dayUseVehicleAttendance, backcountryCabinsAttendance, @@ -209,6 +210,11 @@ async function modifyReportForCSV(report) { ]).result; break; case "Frontcountry Cabins": + // Parties - TOTAL ATTENDANCE + report.calc_frontcountryCabins_parties_totalAttendance = frontcountryCabinsPartiesAttendance( + [report.totalAttendanceParties], + report.config.attendanceModifier + ).result; // NET REVENUE report.calc_frontcountryCabins_camping_netRevenue = basicNetRevenue([ report.revenueGrossCamping, @@ -237,6 +243,7 @@ async function modifyReportForCSV(report) { // People and vehicles - VEHICLE ATTENDANCE report.calc_dayUse_peopleAndVehicles_vehicleAttendance = dayUseVehicleAttendance( + [report.peopleAndVehiclesTrail], [report.peopleAndVehiclesVehicle], [report.peopleAndVehiclesBus], report.config.attendanceVehiclesModifier, diff --git a/lambda/formulaUtils.js b/lambda/formulaUtils.js index b491b5e..b45398a 100644 --- a/lambda/formulaUtils.js +++ b/lambda/formulaUtils.js @@ -99,6 +99,17 @@ exports.frontcountryCampingSecondCarAttendance = function (attendances) { }; }; +exports.frontcountryCabinsPartiesAttendance = function (attendances, modifier) { + let formula = `Total attendance = Parties`; + if (modifier) { + formula += ` x ${modifier}`; + } + return { + result: formatTotalWithModifier(attendances, modifier), + formula: formula + }; +}; + exports.groupCampingStandardAttendance = function (attendances) { return { result: formatTotalWithModifier(attendances), @@ -107,11 +118,13 @@ exports.groupCampingStandardAttendance = function (attendances) { }; exports.dayUseVehicleAttendance = function ( + trailCount, vehicles, buses, vehicleMod, busMod ) { + let trailCountTotal = totalWithModifier(trailCount); let vehicleTotal = totalWithModifier(vehicles, vehicleMod); let busTotal = totalWithModifier(buses, busMod); let vehicleFormula = "Vehicles"; @@ -123,8 +136,8 @@ exports.dayUseVehicleAttendance = function ( busFormula = `(Bus count x ${busMod})`; } return { - result: formatTotalWithModifier([vehicleTotal, busTotal]), - formula: `Vehicle attendance = ${vehicleFormula} + ${busFormula}`, + result: formatTotalWithModifier([vehicleTotal, busTotal, trailCountTotal]), + formula: `Vehicle attendance = ${vehicleFormula} + ${busFormula} + Trail count`, }; };