Skip to content

Commit

Permalink
pkp#10359 Exposing date when editor confirmed review in API with date…
Browse files Browse the repository at this point in the history
…EditorConfirmed
  • Loading branch information
Hafsa-Naeem committed Oct 4, 2024
1 parent d86f5d1 commit c3eca43
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,10 @@ public function unconsiderReview($args, $request)
$user = $request->getUser();
$reviewAssignment = $this->getAuthorizedContextObject(Application::ASSOC_TYPE_REVIEW_ASSIGNMENT);

Repo::reviewAssignment()->edit($reviewAssignment, ['considered' => ReviewAssignment::REVIEW_ASSIGNMENT_UNCONSIDERED]);
Repo::reviewAssignment()->edit($reviewAssignment, [
'considered' => ReviewAssignment::REVIEW_ASSIGNMENT_UNCONSIDERED,
'dateEditorConfirmed' => null
]);

// log the unconsider.
$eventLog = Repo::eventLog()->newDataObject([
Expand Down Expand Up @@ -741,6 +744,9 @@ public function reviewRead($args, $request)
? ReviewAssignment::REVIEW_ASSIGNMENT_CONSIDERED
: ReviewAssignment::REVIEW_ASSIGNMENT_RECONSIDERED;

// set the date when the editor confirms the review
$newReviewData['dateEditorConfirmed'] = Core::getCurrentDate();

if (!$reviewAssignment->getDateCompleted()) {
// Editor completes the review.
$newReviewData['dateConfirmed'] = $newReviewData['dateCompleted'] = Core::getCurrentDate();
Expand Down
3 changes: 3 additions & 0 deletions classes/submission/maps/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,8 @@ protected function getPropertyReviewAssignments(Enumerable $reviewAssignments, b
$dateConfirmed = is_null($reviewAssignment->getDateConfirmed()) ? null : date('Y-m-d', strtotime($reviewAssignment->getDateConfirmed()));
$dateCompleted = is_null($reviewAssignment->getDateCompleted()) ? null : date('Y-m-d', strtotime($reviewAssignment->getDateCompleted()));
$dateAssigned = is_null($reviewAssignment->getDateAssigned()) ? null : date('Y-m-d', strtotime($reviewAssignment->getDateAssigned()));
$dateEditorConfirmed = is_null($reviewAssignment->getData('dateEditorConfirmed')) ? null : date('Y-m-d', strtotime($reviewAssignment->getData('dateEditorConfirmed')));


$reviews[] = [
'id' => (int) $reviewAssignment->getId(),
Expand All @@ -445,6 +447,7 @@ protected function getPropertyReviewAssignments(Enumerable $reviewAssignments, b
'dateResponseDue' => $dateResponseDue,
'dateConfirmed' => $dateConfirmed,
'dateCompleted' => $dateCompleted,
'dateEditorConfirmed' => $dateEditorConfirmed,
'dateAssigned' => $dateAssigned,
'competingInterests' => $reviewAssignment->getCompetingInterests(),
'round' => (int) $reviewAssignment->getRound(),
Expand Down
1 change: 1 addition & 0 deletions classes/submission/reviewAssignment/DAO.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class DAO extends EntityDAO
'step' => 'step',
'reviewFormId' => 'review_form_id',
'considered' => 'considered',
'dateEditorConfirmed' => 'date_editor_confirmed',
'requestResent' => 'request_resent',
];

Expand Down
21 changes: 21 additions & 0 deletions classes/submission/reviewAssignment/ReviewAssignment.php
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,27 @@ public function setConsidered($considered)
$this->setData('considered', $considered);
}

/**
* Get the date the editor confirmed.
*
* @return string|null
*/
public function getDateEditorConfirmed(): ?string
{
return $this->getData('dateEditorConfirmed');
}

/**
* Set the date the editor confirmed.
*
* @param string|null $dateEditorConfirmed
* @return void
*/
public function setDateEditorConfirmed(?string $dateEditorConfirmed): void
{
$this->setData('dateEditorConfirmed', $dateEditorConfirmed);
}

/**
* Get the date the reviewer was rated.
*
Expand Down
10 changes: 10 additions & 0 deletions schemas/reviewAssignment.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@
"in:0,1,2,3"
]
},
"dateEditorConfirmed": {
"type": "string",
"description": "Date when the editor confirmed the review",
"format": "date-time",
"validation": [
"date:Y-m-d H:i:s",
"nullable"
],
"apiSummary": true
},
"dateAcknowledged": {
"type": "string",
"description": "Date editor was familiarized with the review",
Expand Down

0 comments on commit c3eca43

Please sign in to comment.