Skip to content

Commit

Permalink
pkp/pkp-lib#1660 remove static recommendations and added dymanic reco…
Browse files Browse the repository at this point in the history
…mmendations pulling
  • Loading branch information
touhidurabir committed Nov 19, 2024
1 parent 6aecf7f commit 664f865
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 50 deletions.
12 changes: 6 additions & 6 deletions public/globals.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ window.pkp = {
SUBMISSION_REVIEW_METHOD_DOUBLEANONYMOUS: 2,
SUBMISSION_REVIEW_METHOD_OPEN: 3,

SUBMISSION_REVIEWER_RECOMMENDATION_ACCEPT: 1,
SUBMISSION_REVIEWER_RECOMMENDATION_PENDING_REVISIONS: 2,
SUBMISSION_REVIEWER_RECOMMENDATION_RESUBMIT_HERE: 3,
SUBMISSION_REVIEWER_RECOMMENDATION_RESUBMIT_ELSEWHERE: 4,
SUBMISSION_REVIEWER_RECOMMENDATION_DECLINE: 5,
SUBMISSION_REVIEWER_RECOMMENDATION_SEE_COMMENTS: 6,
// SUBMISSION_REVIEWER_RECOMMENDATION_ACCEPT: 1,
// SUBMISSION_REVIEWER_RECOMMENDATION_PENDING_REVISIONS: 2,
// SUBMISSION_REVIEWER_RECOMMENDATION_RESUBMIT_HERE: 3,
// SUBMISSION_REVIEWER_RECOMMENDATION_RESUBMIT_ELSEWHERE: 4,
// SUBMISSION_REVIEWER_RECOMMENDATION_DECLINE: 5,
// SUBMISSION_REVIEWER_RECOMMENDATION_SEE_COMMENTS: 6,

ROLE_ID_MANAGER: 16,
ROLE_ID_SITE_ADMIN: 1,
Expand Down
40 changes: 20 additions & 20 deletions src/composables/useSubmission.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,26 @@ export const ExtendedStagesLabels = {
declined: tk('submissions.declined'),
};

export const RecommendationTranslations = {
[pkp.const.SUBMISSION_REVIEWER_RECOMMENDATION_ACCEPT]: tk(
'reviewer.article.decision.accept',
),
[pkp.const.SUBMISSION_REVIEWER_RECOMMENDATION_PENDING_REVISIONS]: tk(
'reviewer.article.decision.pendingRevisions',
),
[pkp.const.SUBMISSION_REVIEWER_RECOMMENDATION_RESUBMIT_HERE]: tk(
'reviewer.article.decision.resubmitHere',
),
[pkp.const.SUBMISSION_REVIEWER_RECOMMENDATION_RESUBMIT_ELSEWHERE]: tk(
'reviewer.article.decision.resubmitElsewhere',
),
[pkp.const.SUBMISSION_REVIEWER_RECOMMENDATION_DECLINE]: tk(
'reviewer.article.decision.decline',
),
[pkp.const.SUBMISSION_REVIEWER_RECOMMENDATION_SEE_COMMENTS]: tk(
'reviewer.article.decision.seeComments',
),
};
// export const RecommendationTranslations = {
// [pkp.const.SUBMISSION_REVIEWER_RECOMMENDATION_ACCEPT]: tk(
// 'reviewer.article.decision.accept',
// ),
// [pkp.const.SUBMISSION_REVIEWER_RECOMMENDATION_PENDING_REVISIONS]: tk(
// 'reviewer.article.decision.pendingRevisions',
// ),
// [pkp.const.SUBMISSION_REVIEWER_RECOMMENDATION_RESUBMIT_HERE]: tk(
// 'reviewer.article.decision.resubmitHere',
// ),
// [pkp.const.SUBMISSION_REVIEWER_RECOMMENDATION_RESUBMIT_ELSEWHERE]: tk(
// 'reviewer.article.decision.resubmitElsewhere',
// ),
// [pkp.const.SUBMISSION_REVIEWER_RECOMMENDATION_DECLINE]: tk(
// 'reviewer.article.decision.decline',
// ),
// [pkp.const.SUBMISSION_REVIEWER_RECOMMENDATION_SEE_COMMENTS]: tk(
// 'reviewer.article.decision.seeComments',
// ),
// };

const InProgressReviewAssignmentStatuses = [
pkp.const.REVIEW_ASSIGNMENT_STATUS_ACCEPTED,
Expand Down
1 change: 1 addition & 0 deletions src/managers/ReviewerManager/ReviewerManager.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ const props = defineProps({
submission: {type: Object, required: true},
reviewRoundId: {type: Number, required: true},
redactedForAuthors: {type: Boolean, required: false, default: false},
recommendations: {type: Array, required: true},
});
const reviewerStore = useReviewerManagerStore(props);
Expand Down
4 changes: 3 additions & 1 deletion src/managers/ReviewerManager/reviewerManagerStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ export const useReviewerManagerStore = defineComponentStore(
/**
* Config
*/
const {getCellStatusItems} = useReviewerManagerConfig();
const {getCellStatusItems} = useReviewerManagerConfig(
props.recommendations,
);

/**
* Actions
Expand Down
30 changes: 18 additions & 12 deletions src/managers/ReviewerManager/useReviewerManagerConfig.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
import {useLocalize} from '@/composables/useLocalize';
import {useDate} from '@/composables/useDate';
import {RecommendationTranslations} from '@/composables/useSubmission';
export function useReviewerManagerConfig() {
const {t} = useLocalize();
// import {RecommendationTranslations} from '@/composables/useSubmission';
export function useReviewerManagerConfig(recommendations) {
const {t, localize} = useLocalize();
const {formatShortDate} = useDate();

function getCellStatusItems({reviewAssignment}) {
const items = [];

function getRecommendationString(reviewAssignment) {
const recommendationString = reviewAssignment.recommendation
? t(RecommendationTranslations[reviewAssignment.recommendation])
: null;
// const recommendationString = reviewAssignment.recommendation
// ? t(RecommendationTranslations[reviewAssignment.recommendation])
// : null;

if (recommendationString) {
return t('submission.recommendation', {
recommendation: recommendationString,
});
}
// if (recommendationString) {
// return t('submission.recommendation', {
// recommendation: recommendationString,
// });
// }

// return null;

const recommendation = recommendations.filter(
(r) => r.value === reviewAssignment.recommendation,
)[0];

return null;
return recommendation ? localize(recommendation.title) : null;
}

function getCompetingInterests(reviewAssignment) {
Expand Down
5 changes: 5 additions & 0 deletions src/pages/dashboard/DashboardPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ const props = defineProps({
type: Object,
required: true,
},
/** context available reviewer recommendations */
recommendations: {
type: Array,
required: true,
},
});
const store = useDashboardPageStore(props);
Expand Down
17 changes: 8 additions & 9 deletions src/pages/dashboard/composables/useReviewActivityLogic.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import {useLocalize} from '@/composables/useLocalize';
import {useDate} from '@/composables/useDate';
import {
useSubmission,
RecommendationTranslations,
} from '@/composables/useSubmission';
import {useSubmission} from '@/composables/useSubmission';
import {Actions as ReviewerManagerActions} from '@/managers/ReviewerManager/useReviewerManagerActions';
const {tk, t} = useLocalize();
const {tk, t, localize} = useLocalize();

const {calculateDaysBetweenDates} = useDate();
const ReviewActivityActions = {
Expand Down Expand Up @@ -282,7 +279,7 @@ function getDays(config, reviewAssignment) {
return null;
}

export function useReviewActivityLogic() {
export function useReviewActivityLogic(recommendations) {
function getReviewActivityIndicatorProps(reviewAssignment) {
const config = ConfigPerStatus[reviewAssignment.statusId];

Expand Down Expand Up @@ -323,9 +320,11 @@ export function useReviewActivityLogic() {
const date = getDate(config, reviewAssignment);

function getRecommendation() {
return RecommendationTranslations[reviewAssignment.recommendation]
? t(RecommendationTranslations[reviewAssignment.recommendation])
: null;
const recommendation = recommendations.filter(
(r) => r.value === reviewAssignment.recommendation,
)[0];

return recommendation ? localize(recommendation.title) : null;
}

const days = getDays(config, reviewAssignment);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/dashboard/dashboardPageStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ export const useDashboardPageStore = defineComponentStore(
const {
getReviewActivityIndicatorProps,
getReviewActivityIndicatorPopoverProps,
} = useReviewActivityLogic();
} = useReviewActivityLogic(pageInitConfig.recommendations);

return {
// Dashboard
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export function useWorkflowConfigOJS({dashboardPage}) {
if (selectedMenuState.stageId) {
const itemsArgs = {
submission,
pageInitConfig,
selectedPublication,
selectedPublicationId,
selectedStageId: selectedMenuState.stageId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,12 @@ export const WorkflowConfig = {
},

[pkp.const.WORKFLOW_STAGE_ID_EXTERNAL_REVIEW]: {
getPrimaryItems: ({submission, selectedStageId, selectedReviewRound}) => {
getPrimaryItems: ({
submission,
selectedStageId,
selectedReviewRound,
pageInitConfig,
}) => {
const items = [];
if (!selectedReviewRound) {
return [
Expand Down Expand Up @@ -248,6 +253,7 @@ export const WorkflowConfig = {
props: {
submission: submission,
reviewRoundId: selectedReviewRound?.id,
recommendations: pageInitConfig.recommendations,
},
});

Expand Down

0 comments on commit 664f865

Please sign in to comment.