Skip to content

Commit

Permalink
Merge pull request #56 from ruchernchong/55-coe-page-crashing
Browse files Browse the repository at this point in the history
Fix COE values crashing on string with comma separator
  • Loading branch information
ruchernchong authored Jul 9, 2024
2 parents 1e3b0b1 + 04cab78 commit 39bd4ee
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion app/components/HistoricalResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const HistoricalResult = ({ data }: HistoricalResultProps) => {
monthsSet.add(month);
quotaPremiumMap[vehicle_class] = {
...quotaPremiumMap[vehicle_class],
[month]: parseInt(premium, 10),
[month]: premium,
};
});

Expand Down
12 changes: 4 additions & 8 deletions app/components/MonthlyResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,10 @@ export const MonthlyResult = ({ data }: MonthlyResultProps) => {
...new Set(filteredData.map(({ bidding_no }) => bidding_no)),
];
const chartCategories = filteredData.map((item) => item.vehicle_class);
const premium = filteredData.map((item) => parseInt(item.premium, 10));
const bidsReceived = filteredData.map((item) =>
parseInt(item.bids_received.replace(/,/g, ""), 10),
);
const bidsSuccess = filteredData.map((item) =>
parseInt(item.bids_success.replace(/,/g, ""), 10),
);
const quotas = filteredData.map((item) => parseInt(item.quota, 10));
const premium = filteredData.map((item) => item.premium);
const bidsReceived = filteredData.map((item) => item.bids_received);
const bidsSuccess = filteredData.map((item) => item.bids_success);
const quotas = filteredData.map((item) => item.quota);

const graphTitle = ({
month,
Expand Down
8 changes: 4 additions & 4 deletions types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export interface COEResult {
month: string;
bidding_no: string;
vehicle_class: string;
quota: string;
bids_success: string;
bids_received: string;
premium: string;
quota: number;
bids_success: number;
bids_received: number;
premium: number;
}

0 comments on commit 39bd4ee

Please sign in to comment.