mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-08 11:37:25 +00:00
fix bug preventing adding scenario comparison
This commit is contained in:
parent
bd3a141e2b
commit
92bd82a0d5
3 changed files with 9 additions and 3 deletions
|
|
@ -12,7 +12,9 @@ const SelectComparisonModal = ({
|
|||
scenarios: { name: string | null; id: bigint }[];
|
||||
onAddColumn: (columnName: string) => void;
|
||||
}) => {
|
||||
const [selectedScenario, setSelectedScenario] = useState("");
|
||||
const [selectedScenario, setSelectedScenario] = useState(() => {
|
||||
return scenarios && scenarios.length > 0 ? scenarios[0].id.toString() : "";
|
||||
});
|
||||
|
||||
const addColumn = () => {
|
||||
onAddColumn(selectedScenario);
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ export async function getComparsionOverviewScenarioData(
|
|||
next: { revalidate: 60 },
|
||||
});
|
||||
if (!response.ok) {
|
||||
// Print the error
|
||||
console.error(response.statusText);
|
||||
throw new Error("Network response was not ok");
|
||||
}
|
||||
return response.json();
|
||||
|
|
@ -180,7 +182,9 @@ const SummaryTable = ({
|
|||
isOpen={isModalOpen}
|
||||
setIsOpen={setIsModalOpen}
|
||||
scenarios={scenarios}
|
||||
onAddColumn={(id: string) => setSelectedScenarioId(id)}
|
||||
onAddColumn={(id: string) => {
|
||||
setSelectedScenarioId(id);
|
||||
}}
|
||||
/>
|
||||
|
||||
<div className="overflow-x-auto shadow-md sm:rounded-lg">
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ function PlanCard({
|
|||
<EpcCard
|
||||
epcRating={expectedEpcRating}
|
||||
fullMargin={true}
|
||||
expected={isDefault}
|
||||
expected={true}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex-grow pl-4 flex flex-col justify-between">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue