Skip to content

Commit

Permalink
UIOR-1256 use datetime instead of date for csv metadata (#1589)
Browse files Browse the repository at this point in the history
  • Loading branch information
NikitaSedyx committed Apr 18, 2024
1 parent 6c19c93 commit f90e1c3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 19 deletions.
15 changes: 6 additions & 9 deletions src/common/ExportSettingsModal/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ export const EXPORT_ORDER_FIELDS = {
shipTo: 'Ship to',
manualPo: 'Manual',
reEncumber: 'Re-encumber',
createdByUserId: 'Created by',
createdDate: 'Created on',
note: 'Note',
workflowStatus: 'Workflow status',
approved: 'Approved',
Expand All @@ -26,9 +24,9 @@ export const EXPORT_ORDER_FIELDS = {
reviewDate: 'Review date',
poTags: 'PO tags',
createdBy: 'Created by',
dateCreated: 'Date created',
dateCreated: 'Created on',
updatedBy: 'Updated by',
dateUpdated: 'Date updated',
dateUpdated: 'Updated on',
};

export const EXPORT_LINE_FIELDS = {
Expand All @@ -47,7 +45,6 @@ export const EXPORT_LINE_FIELDS = {
description: 'Internal note',
acquisitionMethod: 'Acquisition method',
orderFormat: 'Order format',
createdDateLine: 'Created on (PO Line)',
receiptDate: 'Receipt date',
receiptStatus: 'Receipt status',
paymentStatus: 'Payment status',
Expand Down Expand Up @@ -90,10 +87,10 @@ export const EXPORT_LINE_FIELDS = {
poLineTags: 'POLine tags',
renewalNote: 'Renewal note',
exchangeRate: 'Exchange rate',
poLineCreatedBy: 'Created by (POL)',
poLineDateCreated: 'Date created (POL)',
poLineUpdatedBy: 'Updated by (POL)',
poLineDateUpdated: 'Date updated (POL)',
poLineCreatedBy: 'Created by (PO Line)',
poLineDateCreated: 'Created on (PO Line)',
poLineUpdatedBy: 'Updated by (PO Line)',
poLineDateUpdated: 'Updated on (PO Line)',
};

export const EXPORT_ORDER_FIELDS_OPTIONS = Object.keys(EXPORT_ORDER_FIELDS).map(field => ({
Expand Down
11 changes: 4 additions & 7 deletions src/common/ExportSettingsModal/utils/createExportReport.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ const getOrderExportData = ({
shipToRecord: addressMap[shipTo],
manualPo: !!order.manualPo,
reEncumber: order.reEncumber,
createdByUserId: userMap[order.metadata?.createdByUserId]?.username ?? invalidReference,
createdDate: formatDateTime(order.metadata?.createdDate, intl),
note: order.notes?.join('|'),
workflowStatus: order.workflowStatus,
approved: order.approved,
Expand All @@ -119,9 +117,9 @@ const getOrderExportData = ({
reviewDate: formatDate(order.ongoing?.reviewDate, intl),
poTags: order.tags?.tagList?.join('|'),
createdBy: userMap[order.metadata?.createdByUserId]?.username ?? invalidReference,
dateCreated: formatDate(order.metadata?.createdDate, intl),
dateCreated: formatDateTime(order.metadata?.createdDate, intl),
updatedBy: userMap[order.metadata?.updatedByUserId]?.username ?? invalidReference,
dateUpdated: formatDate(order.metadata?.updatedDate, intl),
dateUpdated: formatDateTime(order.metadata?.updatedDate, intl),
};
};

Expand Down Expand Up @@ -163,7 +161,6 @@ const getOrderLineExportData = ({
description: lineRecord.description,
acquisitionMethod: acquisitionMethodsMap[lineRecord.acquisitionMethod]?.value,
orderFormat: lineRecord.orderFormat,
createdDateLine: formatDate(lineRecord.metadata?.createdDate, intl),
receiptDate: formatDate(lineRecord.receiptDate, intl),
receiptStatus: lineRecord.receiptStatus,
paymentStatus: lineRecord.paymentStatus,
Expand Down Expand Up @@ -206,9 +203,9 @@ const getOrderLineExportData = ({
poLineTags: lineRecord.tags?.tagList?.join('|'),
exchangeRate: lineRecord.cost?.exchangeRate,
poLineCreatedBy: userMap[lineRecord.metadata?.createdByUserId]?.username ?? invalidReference,
poLineDateCreated: formatDate(lineRecord.metadata?.createdDate, intl),
poLineDateCreated: formatDateTime(lineRecord.metadata?.createdDate, intl),
poLineUpdatedBy: userMap[lineRecord.metadata?.updatedByUserId]?.username ?? invalidReference,
poLineDateUpdated: formatDate(lineRecord.metadata?.updatedDate, intl),
poLineDateUpdated: formatDateTime(lineRecord.metadata?.updatedDate, intl),
};
};

Expand Down
3 changes: 0 additions & 3 deletions test/jest/fixtures/exportReport.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ export const exportReport = [
'contributor': '"contributor""Personal name"',
'createInventory': 'Instance, Holding, Item',
'createInventoryE': 'Instance, Holding',
'createdByUserId': 'ui-orders.export.invalidReference',
'createdDate': '2021-08-15',
'createdDateLine': '2021-08-15',
'currency': 'USD',
'description': '',
'discount': '"20""amount"',
Expand Down

0 comments on commit f90e1c3

Please sign in to comment.