Commit 1f556f20 authored by Yannis Barlas's avatar Yannis Barlas

fix(editor panel): show external reviewer info in editor panel

parent 3a89a1c6
......@@ -3,10 +3,11 @@
import React from 'react'
import { adopt } from 'react-adopt'
import { withRouter } from 'react-router-dom'
import { get } from 'lodash'
import { get, union } from 'lodash'
import {
getArticleForEditor,
getExternalTeamsForManuscript,
getReviewsForArticle,
getTeamsForArticle,
manuscriptMetadataUpdate,
......@@ -24,6 +25,7 @@ import {
const mapper = {
getArticleForEditor: props => getArticleForEditor(props),
getExternalTeamsForManuscript: props => getExternalTeamsForManuscript(props),
getReviewsForArticle: props => getReviewsForArticle(props),
getTeamsForArticle: props => getTeamsForArticle(props),
manuscriptMetadataUpdate,
......@@ -33,39 +35,51 @@ const mapper = {
const mapProps = args => {
const teams = get(args.getTeamsForArticle, 'data.teamsForArticle')
const invited = get(
getReviewersTeamByType(teams, 'reviewersInvited'),
'members.length',
const externalTeams = get(
args.getExternalTeamsForManuscript,
'data.getExternalTeamsForManuscript',
)
const accepted = get(
getReviewersTeamByType(teams, 'reviewersAccepted'),
'members.length',
)
const getTeamMembers = type =>
get(getReviewersTeamByType(teams, type), 'members')
const rejected = get(
getReviewersTeamByType(teams, 'reviewersRejected'),
'members.length',
)
const getExternalTeamMembers = type =>
get(getReviewersTeamByType(externalTeams, type), 'members')
const reviewersTeam = getTeamMembers('reviewers')
const invitedReviewers = getTeamMembers('reviewersInvited')
const acceptedReviewers = getTeamMembers('reviewersAccepted')
const rejectedReviewers = getTeamMembers('reviewersRejected')
const reviewersTeam = get(
getReviewersTeamByType(teams, 'reviewers'),
'members',
const externalReviewersTeam = getExternalTeamMembers('externalReviewers')
const externalReviewersInvited = getExternalTeamMembers(
'externalReviewersInvited',
)
const externalReviewersAccepted = getExternalTeamMembers(
'externalReviewersAccepted',
)
const externalReviewersRejected = getExternalTeamMembers(
'externalReviewersRejected',
)
const invitedCount = union(invitedReviewers, externalReviewersInvited).length
const acceptedCount = union(acceptedReviewers, externalReviewersAccepted)
.length
const rejectedCount = union(rejectedReviewers, externalReviewersRejected)
.length
return {
article: args.getArticleForEditor.data.manuscript,
editor: getEditor(args.getTeamsForArticle.data.teamsForArticle),
editorSuggestedReviewers: reviewersTeam,
editorSuggestedReviewers: union(reviewersTeam, externalReviewersTeam),
loading:
args.getTeamsForArticle.loading ||
args.getArticleForEditor.loading ||
args.getReviewsForArticle.loading,
reviewerCounts: {
accepted,
invited,
rejected,
accepted: acceptedCount,
invited: invitedCount,
rejected: rejectedCount,
},
reviews: get(args.getReviewsForArticle, 'data.reviewsForArticle'),
scienceOfficer: getScienceOfficer(
......
......@@ -44,7 +44,7 @@ const ScienceOfficerSection = props => {
<div>
{editorSuggestedReviewers.map(
(reviewer, i) =>
`${reviewer.username}${
`${reviewer.name || reviewer.username}${
i === editorSuggestedReviewers.length - 1 ? '' : ', '
}`,
)}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment