Skip to content

Commit 65d380b

Browse files
committed
Review Comments Export
1 parent 3e13b6e commit 65d380b

2 files changed

Lines changed: 24 additions & 6 deletions

File tree

app/main/exportReviewComments.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const panelLabels = {
2727

2828
const panels = Object.keys(panelLabels);
2929

30-
const saveReviewCommentsToFile = async (mainWindow, exportData, saveDialogResult) => {
30+
const saveReviewCommentsToFile = async(mainWindow, exportData, saveDialogResult) => {
3131
let { filePath, canceled } = saveDialogResult;
3232
if (!canceled && filePath !== undefined) {
3333
if (!filePath.toLowerCase().endsWith('.xlsx')) {
@@ -52,7 +52,7 @@ const saveReviewCommentsToFile = async (mainWindow, exportData, saveDialogResult
5252
// Handle All Comments
5353
let comments = exportData['allComments'].data.map(comment =>
5454
([comment.id, comment.author, comment.text, comment.createdAt, comment.modifiedAt, comment.resolvedAt, comment.resolvedBy,
55-
JSON.stringify(comment.reviewCommentOids), JSON.stringify(comment.sources)
55+
JSON.stringify(comment.reviewCommentOids), JSON.stringify(comment.commentSources)
5656
])
5757
);
5858
workbook.sheet('All Comments').cell('A2').value(comments);
@@ -62,7 +62,7 @@ const saveReviewCommentsToFile = async (mainWindow, exportData, saveDialogResult
6262
}
6363
};
6464

65-
const exportReviewComments = async (mainWindow, exportData) => {
65+
const exportReviewComments = async(mainWindow, exportData) => {
6666
let result = await dialog.showSaveDialog(
6767
mainWindow,
6868
{

app/tabs/reviewCommentTab.js

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,8 @@ class ConnectedReviewCommentTab extends React.Component {
282282
let reviewComment = reviewComments[id];
283283
let commentData = {};
284284
if (extendedFormat) {
285-
commentData = { ...reviewComment, id };
285+
const reviewCommentSources = getSources(mdv, 'ReviewComment', id, odm);
286+
commentData = { ...reviewComment, id, commentSources: reviewCommentSources };
286287
if (reviewComment.resolvedBy) {
287288
commentData.resolvedFlag = 'Yes';
288289
}
@@ -381,7 +382,15 @@ class ConnectedReviewCommentTab extends React.Component {
381382
commentData.parentItemOid = itemGroupOid;
382383
if (itemGroupOid && mdv.itemGroups.hasOwnProperty(itemGroupOid)) {
383384
sourceName = `${sourceName} ${mdv.itemGroups[itemGroupOid].name}.${parentItemDef.name}.${variableName}`;
384-
sourceParts = sourceParts.concat([mdv.itemGroups[itemGroupOid].name, parentItemDef.name, variableName]);
385+
if (sourceParts.length === 0) {
386+
sourceParts = [mdv.itemGroups[itemGroupOid].name, parentItemDef.name, variableName];
387+
} else {
388+
sourceParts = [
389+
sourceParts[0] + ',' + mdv.itemGroups[itemGroupOid].name,
390+
sourceParts[1] + ',' + parentItemDef.name,
391+
sourceParts[2] + ',' + variableName,
392+
];
393+
}
385394
}
386395
});
387396
} else {
@@ -391,7 +400,16 @@ class ConnectedReviewCommentTab extends React.Component {
391400
commentData.parentItemOid = itemGroupOid;
392401
if (itemGroupOid && mdv.itemGroups.hasOwnProperty(itemGroupOid)) {
393402
sourceName = `${sourceName} ${mdv.itemGroups[itemGroupOid].name}.${variableName}`;
394-
sourceParts = sourceParts.concat([mdv.itemGroups[itemGroupOid].name, variableName, '']);
403+
// sourceParts = sourceParts.concat([mdv.itemGroups[itemGroupOid].name, variableName, '']);
404+
if (sourceParts.length === 0) {
405+
sourceParts = [mdv.itemGroups[itemGroupOid].name, variableName, ''];
406+
} else {
407+
sourceParts = [
408+
sourceParts[0] + ',' + mdv.itemGroups[itemGroupOid].name,
409+
sourceParts[1] + ',' + variableName,
410+
'',
411+
];
412+
}
395413
}
396414
});
397415
}

0 commit comments

Comments
 (0)