feat(SW-874): Rename function
This commit is contained in:
@@ -4,7 +4,7 @@ import { useCallback, useState } from "react"
|
||||
|
||||
import RoomFilter from "../RoomFilter"
|
||||
import RoomSelection from "../RoomSelection"
|
||||
import { getLowestPricedRooms } from "./utils"
|
||||
import { getLowestPricedDuplicateRooms } from "./utils"
|
||||
|
||||
import styles from "./rooms.module.css"
|
||||
|
||||
@@ -25,7 +25,7 @@ export default function Rooms({
|
||||
packages,
|
||||
}: Omit<RoomSelectionProps, "selectedPackages">) {
|
||||
console.log("roomsAvailability", roomsAvailability)
|
||||
const visibleRooms: RoomConfiguration[] = getLowestPricedRooms(
|
||||
const visibleRooms: RoomConfiguration[] = getLowestPricedDuplicateRooms(
|
||||
roomsAvailability.roomConfigurations
|
||||
)
|
||||
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
import { RoomConfiguration } from "@/server/routers/hotels/output"
|
||||
|
||||
export function getLowestPricedRooms(roomConfigurations: RoomConfiguration[]) {
|
||||
/**
|
||||
* Get the lowest priced room for each room type that appears more than once.
|
||||
*/
|
||||
|
||||
export function getLowestPricedDuplicateRooms(
|
||||
roomConfigurations: RoomConfiguration[]
|
||||
) {
|
||||
const roomTypeCount = roomConfigurations.reduce(
|
||||
(acc, room) => {
|
||||
acc[room.roomType] = (acc[room.roomType] || 0) + 1
|
||||
|
||||
Reference in New Issue
Block a user