Skip to content

Commit

Permalink
CM-473: adjust to business_data logic (#26)
Browse files Browse the repository at this point in the history
* CM-473: adjust to business_data logic

* CM-473: remove console log

---------

Co-authored-by: Jan <j.dolkowski@soldevelo.com>
  • Loading branch information
jdolkowski and Jan authored Jan 19, 2024
1 parent 563f745 commit 4c5f4ab
Show file tree
Hide file tree
Showing 4 changed files with 9 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
3 changes: 1 addition & 2 deletions src/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ 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) => {
if (['date_valid_to', 'date_valid_from'].includes(key)) {
return `${value} 00:00:00`;
}
Expand Down

0 comments on commit 4c5f4ab

Please sign in to comment.