Skip to content

Commit

Permalink
CM-473: adjust to business_data logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan committed Jan 18, 2024
1 parent 563f745 commit da70841
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const TASK_FULL_PROJECTION = () => [
'isDeleted',
'taskGroup{id, code, completionPolicy, taskexecutorSet {edges{node{id, user{id}}}}}',
'data',
'currentEntityData',
'businessData',
'jsonExt',
];

Expand Down
10 changes: 5 additions & 5 deletions src/components/TaskPreviewCell.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ import React from 'react';
import { HYPHEN } from '../constants';

function TaskPreviewCell({
formatterIndex, itemData, incomingData, formatter, jsonExt,
formatterIndex, itemData, incomingData, formatter,
}) {
const showHistorical = (itemIncomingData) => {
if (formatter(itemData, jsonExt, formatterIndex) === formatter(itemIncomingData, jsonExt, formatterIndex)
|| !formatter(itemIncomingData, jsonExt, formatterIndex)) {
if (formatter(itemData, formatterIndex) === formatter(itemIncomingData, formatterIndex)
|| !formatter(itemIncomingData, formatterIndex)) {
return HYPHEN;
}
return formatter(itemIncomingData, jsonExt, formatterIndex);
return formatter(itemIncomingData, formatterIndex);
};

return (
<>
<p>
{formatter(itemData, jsonExt, formatterIndex) ?? HYPHEN}
{formatter(itemData, formatterIndex) ?? HYPHEN}
</p>
<p style={{ fontWeight: 'bold' }}>
{showHistorical(incomingData)}
Expand Down
5 changes: 2 additions & 3 deletions src/components/TaskPreviewTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,8 @@ function TaskPreviewTable({
<TaskPreviewCell
formatter={formatter}
formatterIndex={formatterIndex}
jsonExt={!previewItem?.jsonExt || JSON.parse(previewItem.jsonExt)}
itemData={previewItem.data?.current_data}
incomingData={previewItem.data?.incoming_data}
itemData={previewItem.businessData?.current_data}
incomingData={previewItem.businessData?.incoming_data}
/>
</TableCell>
))}
Expand Down
4 changes: 2 additions & 2 deletions src/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ function reducer(
task: parseData(action.payload.data.task)?.map((task) => ({
...task,
id: decodeId(task.id),
currentEntityData: parseTaskData(JSON.parse((JSON.parse(task.currentEntityData)))),
data: parseTaskData(JSON.parse(task.data, (key, value) => {
businessData: parseTaskData(JSON.parse(task.businessData, (key, value) => {
console.log(task.businessData)

Check warning on line 119 in src/reducer.js

View workflow job for this annotation

GitHub Actions / lint

Unexpected console statement

Check failure on line 119 in src/reducer.js

View workflow job for this annotation

GitHub Actions / lint

Missing semicolon
if (['date_valid_to', 'date_valid_from'].includes(key)) {
return `${value} 00:00:00`;
}
Expand Down

0 comments on commit da70841

Please sign in to comment.