From f22eddb8513f65eb869cb19af870b267e8659e75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jarda=20Kot=C4=9B=C5=A1ovec?= Date: Thu, 12 Dec 2024 13:09:55 +0100 Subject: [PATCH] pkp/pkp-lib#10684 Internal review improvements on indication and stability --- src/components/StageBubble/StageBubble.vue | 1 + src/composables/useSubmission.js | 46 +++++++++++-------- .../composables/useEditorialLogic.js | 27 ++++++++--- .../workflowConfigEditorialOJS.js | 10 ++-- .../workflowConfigEditorialOMP.js | 5 ++ .../useWorkflowNavigationConfigOJS.js | 1 + 6 files changed, 59 insertions(+), 31 deletions(-) diff --git a/src/components/StageBubble/StageBubble.vue b/src/components/StageBubble/StageBubble.vue index 0b965c221..45ecac925 100644 --- a/src/components/StageBubble/StageBubble.vue +++ b/src/components/StageBubble/StageBubble.vue @@ -14,6 +14,7 @@ export const ExtendedStagesColorClass = { incomplete: 'bg-stage-incomplete-submission', submission: 'bg-stage-desk-review', + internalReview: 'bg-stage-in-review', externalReview: 'bg-stage-in-review', editing: 'bg-stage-copyediting', productionQueued: 'bg-stage-production', diff --git a/src/composables/useSubmission.js b/src/composables/useSubmission.js index cb1cbee00..e3f69c916 100644 --- a/src/composables/useSubmission.js +++ b/src/composables/useSubmission.js @@ -16,7 +16,7 @@ export const ExtendedStages = { export const ExtendedStagesLabels = { incomplete: tk('submissions.incomplete'), submission: tk('manager.publication.submissionStage'), - internalReview: tk('todo'), + internalReview: tk('submission.stage.internalReviewWithRound'), externalReview: tk('submission.stage.externalReviewWithRound'), editing: tk('submission.copyediting'), productionQueued: tk('manager.publication.productionStage'), @@ -108,8 +108,8 @@ export function useSubmission() { ); } - function getCurrentReviewAssignments(submission) { - const currentReviewRound = getCurrentReviewRound(submission); + function getCurrentReviewAssignments(submission, stageId) { + const currentReviewRound = getCurrentReviewRound(submission, stageId); return submission.reviewAssignments.filter( (reviewAssignment) => reviewAssignment.round === currentReviewRound.round, @@ -140,6 +140,8 @@ export function useSubmission() { return submission.submissionProgress ? ExtendedStages.INCOMPLETE : ExtendedStages.SUBMISSION; + case pkp.const.WORKFLOW_STAGE_ID_INTERNAL_REVIEW: + return ExtendedStages.INTERNAL_REVIEW; case pkp.const.WORKFLOW_STAGE_ID_EXTERNAL_REVIEW: return ExtendedStages.EXTERNAL_REVIEW; case pkp.const.WORKFLOW_STAGE_ID_EDITING: @@ -158,32 +160,37 @@ export function useSubmission() { function getExtendedStageLabel(submission) { const extendedStage = getExtendedStage(submission); - const round = - extendedStage === ExtendedStages.EXTERNAL_REVIEW - ? submission.reviewRounds[submission.reviewRounds.length - 1].round - : undefined; + + let round = undefined; + + const activeStage = getActiveStage(submission); + + if ( + activeStage.id === pkp.const.WORKFLOW_STAGE_ID_EXTERNAL_REVIEW || + activeStage.id === pkp.const.WORKFLOW_STAGE_ID_INTERNAL_REVIEW + ) { + const rounds = getReviewRoundsForStage(submission, activeStage.id); + round = rounds[rounds.length - 1].round; + } + return t(ExtendedStagesLabels[extendedStage], { round, }); } - function getFileStageFromWorkflowStage(submission) { - const FileStageMapping = { - [pkp.const.WORKFLOW_STAGE_ID_SUBMISSION]: - pkp.const.SUBMISSION_FILE_SUBMISSION, - [pkp.const.WORKFLOW_STAGE_ID_EXTERNAL_REVIEW]: - pkp.const.SUBMISSION_FILE_REVIEW_REVISION, - [pkp.const.WORKFLOW_STAGE_ID_EDITING]: pkp.const.SUBMISSION_FILE_FINAL, - }; - - return FileStageMapping[submission.stageId]; - } - function hasSubmissionPassedStage(submission, stageId) { return submission.stageId > stageId; } function hasNotSubmissionStartedStage(submission, stageId) { + if ( + submission.stageId === pkp.const.WORKFLOW_STAGE_ID_EXTERNAL_REVIEW || + submission.stageId === pkp.const.WORKFLOW_STAGE_ID_INTERNAL_REVIEW + ) { + const rounds = getReviewRoundsForStage(submission, stageId); + return rounds?.length === 0; + } + return submission.stageId < stageId; } @@ -252,7 +259,6 @@ export function useSubmission() { getCurrentReviewAssignments, getCurrentPublication, getLatestPublication, - getFileStageFromWorkflowStage, hasNotSubmissionStartedStage, hasSubmissionPassedStage, // review assignments diff --git a/src/pages/dashboard/composables/useEditorialLogic.js b/src/pages/dashboard/composables/useEditorialLogic.js index 9d7bc3b9e..158d8fbb2 100644 --- a/src/pages/dashboard/composables/useEditorialLogic.js +++ b/src/pages/dashboard/composables/useEditorialLogic.js @@ -29,8 +29,11 @@ export function useEditorialLogic() { ]; } } - if (activeStage.id === pkp.const.WORKFLOW_STAGE_ID_EXTERNAL_REVIEW) { - const activeRound = getCurrentReviewRound(submission); + if ( + activeStage.id === pkp.const.WORKFLOW_STAGE_ID_EXTERNAL_REVIEW || + activeStage.id === pkp.const.WORKFLOW_STAGE_ID_INTERNAL_REVIEW + ) { + const activeRound = getCurrentReviewRound(submission, activeStage.id); if (activeStage.currentUserDecidingEditor) { // just hack for illustration @@ -76,7 +79,10 @@ export function useEditorialLogic() { component: 'CellSubmissionActivityReviews', props: { submissionId: submission.id, - reviewAssignments: getCurrentReviewAssignments(submission), + reviewAssignments: getCurrentReviewAssignments( + submission, + activeStage.id, + ), }, }, ]; @@ -107,7 +113,10 @@ export function useEditorialLogic() { component: 'CellSubmissionActivityReviews', props: { submissionId: submission.id, - reviewAssignments: getCurrentReviewAssignments(submission), + reviewAssignments: getCurrentReviewAssignments( + submission, + activeStage.id, + ), }, }, ]; @@ -187,7 +196,10 @@ export function useEditorialLogic() { component: 'CellSubmissionActivityReviews', props: { submissionId: submission.id, - reviewAssignments: getCurrentReviewAssignments(submission), + reviewAssignments: getCurrentReviewAssignments( + submission, + activeStage.id, + ), }, }, ]; @@ -219,7 +231,10 @@ export function useEditorialLogic() { }, ]; } else { - const reviewAssignments = getCurrentReviewAssignments(submission); + const reviewAssignments = getCurrentReviewAssignments( + submission, + activeStage.id, + ); return [ { diff --git a/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOJS.js b/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOJS.js index d8ff213c2..3e6af136f 100644 --- a/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOJS.js +++ b/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOJS.js @@ -328,11 +328,6 @@ export const WorkflowConfig = { return []; } - const actionArgs = { - stageId: pkp.const.WORKFLOW_STAGE_ID_EXTERNAL_REVIEW, - reviewRoundId: selectedReviewRound.id, - }; - const selectedStage = getStageById(submission, selectedStageId); const isRecommendOnlyEditor = selectedStage.currentUserCanRecommendOnly; @@ -347,6 +342,11 @@ export const WorkflowConfig = { }, }); } else { + const actionArgs = { + stageId: pkp.const.WORKFLOW_STAGE_ID_EXTERNAL_REVIEW, + reviewRoundId: selectedReviewRound.id, + }; + addItemIf( items, { diff --git a/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOMP.js b/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOMP.js index bc5f33520..9f7329cb8 100644 --- a/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOMP.js +++ b/src/pages/workflow/composables/useWorkflowConfig/workflowConfigEditorialOMP.js @@ -234,6 +234,11 @@ export const WorkflowConfig = { }, getActionItems: ({submission, selectedStageId, selectedReviewRound}) => { const items = []; + + if (!selectedReviewRound) { + return []; + } + const {getCurrentReviewRound} = useSubmission(); const currentReviewRound = getCurrentReviewRound( diff --git a/src/pages/workflow/composables/useWorkflowNavigationConfig/useWorkflowNavigationConfigOJS.js b/src/pages/workflow/composables/useWorkflowNavigationConfig/useWorkflowNavigationConfigOJS.js index 48120ce6f..87d5b36f9 100644 --- a/src/pages/workflow/composables/useWorkflowNavigationConfig/useWorkflowNavigationConfigOJS.js +++ b/src/pages/workflow/composables/useWorkflowNavigationConfig/useWorkflowNavigationConfigOJS.js @@ -7,6 +7,7 @@ const {t} = useLocalize(); const StageColors = { [pkp.const.WORKFLOW_STAGE_ID_SUBMISSION]: 'border-stage-desk-review', + [pkp.const.WORKFLOW_STAGE_ID_INTERNAL_REVIEW]: 'border-stage-in-review', [pkp.const.WORKFLOW_STAGE_ID_EXTERNAL_REVIEW]: 'border-stage-in-review', [pkp.const.WORKFLOW_STAGE_ID_EDITING]: 'border-stage-copyediting', [pkp.const.WORKFLOW_STAGE_ID_PRODUCTION]: 'border-stage-production',