Skip to content

Commit

Permalink
Merge pull request #1 from IQSS/review_files_check
Browse files Browse the repository at this point in the history
Added review files check to submission closed scheduled task
  • Loading branch information
abujeda authored May 15, 2024
2 parents 0c36163 + 0f6c769 commit 9832431
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion pprOjsPlugin/tasks/PPRSubmissionClosedAuthorNotification.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ function executeForContext($context, $pprPluginSettings) {
'closedSubmissionsAfterPeriod' => 0,
'closedSubmissionsWithNotifications' => 0,
'sendToAuthorMissing' => 0,
'reviewFilesMissing' => 0,
'sentNotifications' => 0,
];

Expand Down Expand Up @@ -107,6 +108,14 @@ function executeForContext($context, $pprPluginSettings) {
continue;
}

if (!$this->reviewFilesForSubmission($closedSubmission)) {
// ALL CLOSED SUBMISSIONS SHOULD HAVE REVIEW FILES
// LOG TO DEBUG WITH PRODUCT TEAM
$this->log($context, sprintf("reviewFiles not found - closedSubmission=%s", $closedSubmission->getId()));
$metrics['reviewFilesMissing']++;
continue;
}

$authorNotifications = $pprNotificationRegistry->getSubmissionClosedAuthorNotification($closedSubmission->getId());
if (empty($authorNotifications)) {
$this->sendNotification($closedSubmission, $context);
Expand All @@ -118,7 +127,29 @@ function executeForContext($context, $pprPluginSettings) {
}
}

$this->log($context, sprintf("Completed - closedSubmissions=%s closedSubmissionsAfterPeriod=%s sendToAuthorMissing=%s closedSubmissionsWithNotifications=%s sentNotifications=%s", $metrics['closedSubmissions'], $metrics['closedSubmissionsAfterPeriod'], $metrics['sendToAuthorMissing'], $metrics['closedSubmissionsWithNotifications'], $metrics['sentNotifications']));
$this->log($context, sprintf("Completed - closedSubmissions=%s closedSubmissionsAfterPeriod=%s sendToAuthorMissing=%s reviewFilesMissing=%s closedSubmissionsWithNotifications=%s sentNotifications=%s",
$metrics['closedSubmissions'],
$metrics['closedSubmissionsAfterPeriod'],
$metrics['sendToAuthorMissing'],
$metrics['reviewFilesMissing'],
$metrics['closedSubmissionsWithNotifications'],
$metrics['sentNotifications']));
}

private function reviewFilesForSubmission($submission) {
import('lib.pkp.classes.submission.SubmissionFile'); // Bring the file constants.
$params = [
'submissionIds' => [$submission->getId()],
'fileStages' => [SUBMISSION_FILE_REVIEW_ATTACHMENT],
];
$submissionFilesIterator = Services::get('submissionFile')->getMany($params);
$submissionReviewFiles = iterator_to_array($submissionFilesIterator);

if (empty($submissionReviewFiles)) {
return false;
}

return true;
}

private function requestedRevisionsForSubmission($submission) {
Expand Down

0 comments on commit 9832431

Please sign in to comment.