Skip to content

Commit a821efd

Browse files
committed
Extract constants from CSV
1 parent c89747e commit a821efd

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

relog-web/src/casebuilder/PlantBlock.js

+3-8
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,8 @@ const PlantBlock = (props) => {
6363
});
6464
const result = {};
6565
data.forEach((el) => {
66-
result[el["name"]] = {
67-
"latitude (deg)": el["latitude (deg)"],
68-
"longitude (deg)": el["longitude (deg)"],
69-
"area cost factor": el["area cost factor"],
70-
};
66+
let { name, ...props } = el;
67+
result[name] = props;
7168
});
7269
onChange(result, "locations");
7370
};
@@ -79,9 +76,7 @@ const PlantBlock = (props) => {
7976
)) {
8077
result.push({
8178
name: locationName,
82-
"latitude (deg)": locationDict["latitude (deg)"],
83-
"longitude (deg)": locationDict["longitude (deg)"],
84-
"area cost factor": locationDict["area cost factor"],
79+
...locationDict,
8580
});
8681
}
8782
generateFile(`Candidate locations - ${props.name}.csv`, csvFormat(result));

0 commit comments

Comments
 (0)