Skip to content

Commit

Permalink
Add multiple locations
Browse files Browse the repository at this point in the history
  • Loading branch information
Fosten committed Jun 27, 2024
1 parent f379ca4 commit c911a1d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/components/Blocks/PlantLogs/View.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ const View = (props) => {
<td>{item[2]}</td>
<td>{item[3]}</td>
<td>{item[4]}</td>
<td>{item[5]}</td>
<td>{item[6]}</td>
<td>{item[7]}</td>
<td>{item[8]}</td>
</Table.Row>
);
})
Expand Down
5 changes: 2 additions & 3 deletions src/components/Blocks/PlantLogs/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,10 @@ const WholeDataResponse = (props) => {
const include = ['asset', 'location'];
return farm.log.fetch({ filter, include, limit: 1 });
});

Promise.all(requests).then((responses) => {
responses.forEach(async (respP) => {
var {
data: [remoteLog, remoteAsset, remoteLocation],
data: [remoteLog, remoteAsset, remoteLocation, remoteLocation2, remoteLocation3, remoteLocation4, remoteLocation5],
} = respP;
if (typeof remoteLocation == 'undefined') {
remoteLocation = { attributes: { name: null } };
Expand All @@ -60,7 +59,7 @@ const WholeDataResponse = (props) => {
relationships: { plant_type: [{ id: null }] },
};
}
const objectPName = [remoteLog?.attributes.name, remoteLog?.attributes.timestamp, remoteLog?.attributes.status, remoteAsset?.attributes.name, remoteLocation?.attributes.name, remoteLog?.attributes.timestamp];
const objectPName = [remoteLog?.attributes.name, remoteLog?.attributes.timestamp, remoteLog?.attributes.status, remoteAsset?.attributes.name, remoteLocation?.attributes.name, remoteLocation2?.attributes.name, remoteLocation3?.attributes.name, remoteLocation4?.attributes.name, remoteLocation5?.attributes.name];
newlyarray.push(objectPName);
});
var okthen = { newlyarray };
Expand Down

0 comments on commit c911a1d

Please sign in to comment.