Skip to content
Snippets Groups Projects
Commit 16f808ab authored by Mihail Hagiu's avatar Mihail Hagiu
Browse files

feat(ReviewerNumbering): Reviewers are now numbered correctly in ReviewerTable and ReviewerDetails

parent 25b54fa2
No related branches found
No related tags found
3 merge requests!176Sprint 24,!171Sprint 24,!158Hin 1115
......@@ -41,9 +41,9 @@ const ReviewersTable = ({
invitation,
'person.lastName',
)}`}</Text>
{invitation.isAccepted && (
{invitation.reviewerNumber && (
<Text customId ml={1}>
{renderAcceptedLabel(index)}
Reviewer {invitation.reviewerNumber}
</Text>
)}
</td>
......@@ -102,12 +102,7 @@ export default compose(
withProps(({ invitations = [] }) => ({
invitations: orderBy(invitations, orderInvitations),
})),
withProps(({ invitations = [] }) => ({
firstAccepted: invitations.findIndex(i => i.hasAnswer && i.isAccepted),
})),
withHandlers({
renderAcceptedLabel: ({ firstAccepted, invitations }) => index =>
`Reviewer ${index - firstAccepted + 1}`,
getInvitationStatus: () => ({ hasAnswer, isAccepted }) => {
if (!hasAnswer) return 'PENDING'
if (isAccepted) return 'ACCEPTED'
......
......@@ -119,14 +119,14 @@ const ReviewerDetails = ({
{reports.length === 0 && (
<Text align="center">No reports submitted yet.</Text>
)}
{reports.map((report, index) => (
{reports.map(report => (
<ReviewerReport
journal={journal}
key={report.id}
onDownload={downloadFile}
onPreview={previewFile}
report={report}
reviewerIndex={index + 1}
reviewerIndex={report.reviewerNumber}
showOwner
/>
))}
......
import { get, chain } from 'lodash'
import { get, chain, find } from 'lodash'
export const handleError = fn => e => {
fn(get(JSON.parse(e.response), 'error', 'Oops! Something went wrong!'))
......@@ -11,4 +11,13 @@ export const getReportComments = ({ report, isPublic = false }) =>
.get('content')
.value()
export const indexReviewers = (reports, invitations) => reports
export const indexReviewers = (reports, invitations) => {
reports.forEach(report => {
report.reviewerNumber = get(
find(invitations, ['userId', report.userId]),
'reviewerNumber',
0,
)
})
return reports
}
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