Skip to content

Commit

Permalink
pkp/pkp-lib#10684 Internal review improvements on indication and stab…
Browse files Browse the repository at this point in the history
…ility
  • Loading branch information
jardakotesovec committed Dec 12, 2024
1 parent 068bf9a commit f22eddb
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 31 deletions.
1 change: 1 addition & 0 deletions src/components/StageBubble/StageBubble.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
46 changes: 26 additions & 20 deletions src/composables/useSubmission.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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:
Expand All @@ -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;
}

Expand Down Expand Up @@ -252,7 +259,6 @@ export function useSubmission() {
getCurrentReviewAssignments,
getCurrentPublication,
getLatestPublication,
getFileStageFromWorkflowStage,
hasNotSubmissionStartedStage,
hasSubmissionPassedStage,
// review assignments
Expand Down
27 changes: 21 additions & 6 deletions src/pages/dashboard/composables/useEditorialLogic.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -76,7 +79,10 @@ export function useEditorialLogic() {
component: 'CellSubmissionActivityReviews',
props: {
submissionId: submission.id,
reviewAssignments: getCurrentReviewAssignments(submission),
reviewAssignments: getCurrentReviewAssignments(
submission,
activeStage.id,
),
},
},
];
Expand Down Expand Up @@ -107,7 +113,10 @@ export function useEditorialLogic() {
component: 'CellSubmissionActivityReviews',
props: {
submissionId: submission.id,
reviewAssignments: getCurrentReviewAssignments(submission),
reviewAssignments: getCurrentReviewAssignments(
submission,
activeStage.id,
),
},
},
];
Expand Down Expand Up @@ -187,7 +196,10 @@ export function useEditorialLogic() {
component: 'CellSubmissionActivityReviews',
props: {
submissionId: submission.id,
reviewAssignments: getCurrentReviewAssignments(submission),
reviewAssignments: getCurrentReviewAssignments(
submission,
activeStage.id,
),
},
},
];
Expand Down Expand Up @@ -219,7 +231,10 @@ export function useEditorialLogic() {
},
];
} else {
const reviewAssignments = getCurrentReviewAssignments(submission);
const reviewAssignments = getCurrentReviewAssignments(
submission,
activeStage.id,
);

return [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -347,6 +342,11 @@ export const WorkflowConfig = {
},
});
} else {
const actionArgs = {
stageId: pkp.const.WORKFLOW_STAGE_ID_EXTERNAL_REVIEW,
reviewRoundId: selectedReviewRound.id,
};

addItemIf(
items,
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,11 @@ export const WorkflowConfig = {
},
getActionItems: ({submission, selectedStageId, selectedReviewRound}) => {
const items = [];

if (!selectedReviewRound) {
return [];
}

const {getCurrentReviewRound} = useSubmission();

const currentReviewRound = getCurrentReviewRound(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit f22eddb

Please sign in to comment.