Skip to content

Commit

Permalink
pkp/pkp-lib#10674 Add scenarios when the review assignment is decline…
Browse files Browse the repository at this point in the history
…d and moved to copyediting&production stage (covered in pkp/pkp-lib#10970)
  • Loading branch information
jardakotesovec committed Feb 25, 2025
1 parent a463c45 commit c5f1fb4
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 19 deletions.
7 changes: 4 additions & 3 deletions src/composables/useSubmission.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,13 @@ const InProgressReviewAssignmentStatuses = [
pkp.const.REVIEW_ASSIGNMENT_STATUS_ACCEPTED,
pkp.const.REVIEW_ASSIGNMENT_STATUS_REVIEW_OVERDUE,
];
const CompletedReviewAssignmentStatuses = [

// Submitted reviews
export const CompletedReviewAssignmentStatuses = [
pkp.const.REVIEW_ASSIGNMENT_STATUS_RECEIVED,
pkp.const.REVIEW_ASSIGNMENT_STATUS_COMPLETE,
pkp.const.REVIEW_ASSIGNMENT_STATUS_THANKED,
pkp.const.REVIEW_ASSIGNMENT_STATUS_CANCELLED,
pkp.const.REVIEW_ASSIGNMENT_STATUS_REQUEST_RESEND,
pkp.const.REVIEW_ASSIGNMENT_STATUS_VIEWED,
];

const IgnoredReviewAssignmentStatuses = [
Expand Down
7 changes: 5 additions & 2 deletions src/pages/dashboard/DashboardPage.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,11 @@ export const ReviewAssignmentStatusesReviewer = {
<li><b>8.REVIEW_ASSIGNMENT_STATUS_THANKED</b> - reviewer has been thanked </li>
<li><b>9.REVIEW_ASSIGNMENT_STATUS_REQUEST_RESEND</b> - request resent to reviewer after they declined</li>
<li><b>10.REVIEW_ASSIGNMENT_STATUS_VIEWED</b> -editor viewed the review, but not confirm</li>
<li><b>11.REVIEW_ASSIGNMENT_STATUS_CANCELLED</b> - reviewer cancelled review request // should not be displayed </li>
</ul>
<li><b>11.REVIEW_ASSIGNMENT_STATUS_ACCEPTED + copy/prod stage</b> - submission moved to the copyediting/production stage, considered as incomplete</li>
<li><b>12.REVIEW_ASSIGNMENT_STATUS_DECLINED + copy/prod stage</b> - submission moved to the copyediting/production stage, still indicate declined</li>
<li><b>13.REVIEW_ASSIGNMENT_STATUS_CANCELLED</b> - reviewer cancelled review request / should not be displayed </li>
</ul>
<DashboardPage v-bind="args" />`,
}),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<TableCell>
<PkpButton
v-if="actionLabel"
class="-ms-3"
:aria-describedby="'submission-title-' + item.id"
:is-link="true"
Expand All @@ -18,6 +19,8 @@
import {defineProps, computed} from 'vue';
import PkpButton from '@/components/Button/Button.vue';
import TableCell from '@/components/Table/TableCell.vue';
import {CompletedReviewAssignmentStatuses} from '@/composables/useSubmission.js';
import {useDashboardPageStore} from '@/pages/dashboard/dashboardPageStore.js';
import {useLocalize} from '@/composables/useLocalize';
Expand All @@ -28,6 +31,19 @@ const props = defineProps({
});
const actionLabel = computed(() => {
// Submission progress to copyediting/production stage
if (
[
pkp.const.WORKFLOW_STAGE_ID_EDITING,
pkp.const.WORKFLOW_STAGE_ID_PRODUCTION,
].includes(props.item.stageId)
) {
// It the review assignment is incomplete, show no action
// for complete sceario it will fallback to the 'View' below
if (!CompletedReviewAssignmentStatuses.includes(props.item.status)) {
return null;
}
}
switch (props.item.status) {
case pkp.const.REVIEW_ASSIGNMENT_STATUS_AWAITING_RESPONSE:
case pkp.const.REVIEW_ASSIGNMENT_STATUS_RESPONSE_OVERDUE:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import {useSubmission} from '@/composables/useSubmission.js';
import {
useSubmission,
CompletedReviewAssignmentStatuses,
} from '@/composables/useSubmission.js';
import {useLocalize} from '@/composables/useLocalize';
import {useDate} from '@/composables/useDate';
import {Actions as ParticipantManagerActions} from '@/managers/ParticipantManager/useParticipantManagerActions';
Expand Down Expand Up @@ -383,34 +386,61 @@ export function useDashboardConfigEditorialActivity() {
}

function getEditorialActivityForMyReviewAssignments(reviewAssignment) {
console.log(
'getEditorialActivityForMyReviewAssignments',
reviewAssignment.status,
);

// When declined always show the same status regardless of the stage
if (
[
pkp.const.REVIEW_ASSIGNMENT_STATUS_AWAITING_RESPONSE,
pkp.const.REVIEW_ASSIGNMENT_STATUS_REQUEST_RESEND,
].includes(reviewAssignment.status)
reviewAssignment.status === pkp.const.REVIEW_ASSIGNMENT_STATUS_DECLINED
) {
const date = reviewAssignment.dateResponseDue;
// indeed when declined, the dateConfirmed gets set regardless if its accepted or declined
const date = reviewAssignment.dateConfirmed;

return [
{
component: 'DashboardCellReviewAssignmentActivityAlert',
props: {
alert: t('dashboard.reviewAssignment.acceptOrDeclineRequestDate', {
alert: t('dashboard.reviewAssignment.declined', {
date: formatShortDate(date),
}),
},
},
];
}
// if the submission moved to editorial / production stage
else if (
[
pkp.const.WORKFLOW_STAGE_ID_EDITING,
pkp.const.WORKFLOW_STAGE_ID_PRODUCTION,
].includes(reviewAssignment.stageId)
) {
// It the review assignment is incomplete
if (
!CompletedReviewAssignmentStatuses.includes(reviewAssignment.status)
) {
return [
{
component: 'DashboardCellReviewAssignmentActivityAlert',
props: {
alert: t(`submissions.incomplete`),
},
},
];
}
} else if (
reviewAssignment.status === pkp.const.REVIEW_ASSIGNMENT_STATUS_DECLINED
[
pkp.const.REVIEW_ASSIGNMENT_STATUS_AWAITING_RESPONSE,
pkp.const.REVIEW_ASSIGNMENT_STATUS_REQUEST_RESEND,
].includes(reviewAssignment.status)
) {
// indeed when declined, the dateConfirmed gets set regardless if its accepted or declined
const date = reviewAssignment.dateConfirmed;

const date = reviewAssignment.dateResponseDue;
return [
{
component: 'DashboardCellReviewAssignmentActivityAlert',
props: {
alert: t('dashboard.reviewAssignment.declined', {
alert: t('dashboard.reviewAssignment.acceptOrDeclineRequestDate', {
date: formatShortDate(date),
}),
},
Expand Down Expand Up @@ -439,7 +469,9 @@ export function useDashboardConfigEditorialActivity() {
{
component: 'DashboardCellReviewAssignmentActivityAlert',
props: {
alert: t('dashboard.reviewAssignment.completeReviewByDate', {date}),
alert: t('dashboard.reviewAssignment.completeReviewByDate', {
date,
}),
},
},
];
Expand All @@ -463,7 +495,7 @@ export function useDashboardConfigEditorialActivity() {
pkp.const.REVIEW_ASSIGNMENT_STATUS_VIEWED,
pkp.const.REVIEW_ASSIGNMENT_STATUS_COMPLETE,
pkp.const.REVIEW_ASSIGNMENT_STATUS_THANKED,
].includes(reviewAssignment.statusId)
].includes(reviewAssignment.status)
) {
const date = reviewAssignment.dateCompleted;

Expand Down
15 changes: 15 additions & 0 deletions src/pages/dashboard/mocks/reviewAssignmentScenariosMock.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {getReviewAssignmentFullMock} from './reviewAssignmentsMock';
export const ReviewAssignmentEditorialActivityScenario = [
// Review stage
//REVIEW_ASSIGNMENT_STATUS_AWAITING_RESPONSE // request has been sent but reviewer has not responded
getReviewAssignmentFullMock({
submissionId: 1,
Expand Down Expand Up @@ -50,4 +51,18 @@ export const ReviewAssignmentEditorialActivityScenario = [
submissionId: 10,
statusId: pkp.const.REVIEW_ASSIGNMENT_STATUS_VIEWED,
}),
// When moved to copyediting / production stage
// When the review was not completed (submitted)
getReviewAssignmentFullMock({
submissionId: 11,
statusId: pkp.const.REVIEW_ASSIGNMENT_STATUS_ACCEPTED,
stageId: pkp.const.WORKFLOW_STAGE_ID_PRODUCTION,
}),
// When moved to copyediting / production stage
// When the review was declined - same indication for declined regardless of the stage
getReviewAssignmentFullMock({
submissionId: 12,
statusId: pkp.const.REVIEW_ASSIGNMENT_STATUS_DECLINED,
stageId: pkp.const.WORKFLOW_STAGE_ID_PRODUCTION,
}),
];

0 comments on commit c5f1fb4

Please sign in to comment.