Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkp/pkp-lib#5885 Review remainder update #9612

Merged
merged 23 commits into from
Aug 30, 2024
Merged

Conversation

touhidurabir
Copy link
Member

for #5885

Copy link
Collaborator

@Vitaliy-1 Vitaliy-1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @touhidurabir! I left a couple of minor comments but what I'm thinking about is the possibility for journals to set the number of reminders they want rather than predefined before... and after... fields. Have you considered this option?

'size' => 'small',
]))
->addField(new FieldText('numDaysBeforeSubmitReminder', [
// $this->addField(new FieldText('numDaysBeforeInviteReminder', [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just keeping a reminder that these commented lines should be removed before merging

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed .

// ]));

$this
->addField(new FieldHTML('reviewRequestResponseRemainder', [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reviewRequestResponseRemainder => submissionReviewResponseReminder

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.


namespace PKP\migration\upgrade\v3_5_0;

use Illuminate\Database\Schema\Blueprint;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check which imports are not necessary here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

$currentDate->gte($dateResponseDue) &&
$currentDate->diffInDays($dateResponseDue) >= $numDaysAfterReviewResponseReminderDue) {

// ACTION:-> we need to sent a AFTER REVIEW REQUEST RESPONSE remainder
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...to send the AFTER REVIEW REQUEST RESPONSE reminder

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check this in other comments too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.


if ($reviewAssignment->getDateConfirmed() === null) {
// review request has not been responded
// previous remainder was a BEFORE REVIEW REQUEST RESPONSE remainder
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reminder

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

use Exception;
use PKP\validation\ValidatorFactory;

class ValidatorDateConparison extends Validator
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ValidatorDateConparison => ValidatorDateComparison

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

* @param string $type the type of check, either "required" or "optional"
* @param string $message the error message for validation failures (i18n key)
*/
public function __construct(&$form, $field, $comparingDate, $comparingRule, $type = 'optional', $message = 'email.invalid')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default value for $message looks wrong

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.


$submission = Repo::submission()->get($this->submissionId);

$contextService = Services::get("context");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"context" => 'context'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

use PKP\jobs\BaseJob;


class ReviewRemainder extends BaseJob
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ReviewReminder

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

@Vitaliy-1
Copy link
Collaborator

@touhidurabir, thinking about this further, one way to achieve this is adding a context setting that depicts a number of email reminders to show. Something like:

$this->addField(new FieldText('numReviewRequestResponseReminders', [
    'label' => __('manager.setup.reviewOptions.numReviewRequestResponseReminders'),
     'description' => __('manager.setup.reviewOptions.numReviewRequestResponseReminders.description'),
     'value' => $context->getData('numReviewRequestResponseReminders'),
     'size' => 'small',
]));

And a setting to hold values for all custom fields. Each reminder option should accept negative numbers if implementing this way

foreach ($context->getData('reviewRequestResponseReminders') as $reviewRequestResponseReminder) {
    $this->addField(new FieldText('requestResponseReminder', [
    ...
    ]));
}

This also requires Vue form modification to support new fields added/subtracted dynamically - by listening to the change event, which is emitted when a field prop changes.

Another way could be adding a new form field component that dynamically supports custom number of inputs depending on a value of another field...

@touhidurabir
Copy link
Member Author

Hi @Vitaliy-1 , can you explain how the negative number works in bit more details , I am still bit confused how it will work . I have followed the following implementation approach

  1. set reminder day before and after the review request response due date if invited reviewer has not yet responded to the review invitation request.
  2. set reminder day before and after the review submission due date if the reviewer has accepted the invitation but has not submitted the review yet .

The implementation that I have designed is so that it will only sent one such reminder for each case that is

  1. sent only one review request response due reminder before the response due date if has not yet responded to the request and only if that day value is set .
  2. sent only one review request response due reminder after the response due date if has not yet responded to the request and only if that day value is set .
  3. sent only one review submission due reminder before the review submission due date if reviewer has not yet submitted the review and only if that day value is set .
  4. sent only one review submission due reminder after the review submission due date if reviewer has not yet submitted the review and only if that day value is set .

so for each above 4 cases, only one reminder for each case and no more than that .

@asmecher
Copy link
Member

Hey @touhidurabir -- please hold off on this one until @Devika008 has had a chance to review things.

Copy link
Member

@asmecher asmecher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is promising, @touhidurabir; I've added some comments, and it also needs some work per Devika's design work to make it friendlier.

}

if (!PKP_STRICT_MODE) {
class_alias('\PKP\form\validation\FormValidatorDateCompare', '\FormValidatorDateCompare');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should only be necessary for old code; for new code, just make sure to use FQCNs and use statements where they're needed.

{
parent::__construct(__('publication.jats.defaultContentCreationError'), null, $innerException);
parent::__construct(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these changes be in a different PR?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these changes be in a different PR?

that is true but because of this I was having some issue with some of workflow page loading to run some tests

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's already been resolved in main in 8ded2f3.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then it will be removed at next rebase

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still showing up in the PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept it because we are passing second param as null at here which is not allowed as that should be a int as specified here

classes/task/ReviewReminder.php Show resolved Hide resolved
jobs/email/ReviewReminder.php Outdated Show resolved Hide resolved
@touhidurabir touhidurabir force-pushed the i5885_main branch 2 times, most recently from 60dae69 to 8cf585d Compare February 19, 2024 11:27
@touhidurabir
Copy link
Member Author

@asmecher take a look at the PR again .

@touhidurabir touhidurabir force-pushed the i5885_main branch 2 times, most recently from 00e1ad2 to f545ee4 Compare April 19, 2024 11:27
Copy link
Member

@asmecher asmecher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @touhidurabir; here are some minor changes to suggest. When this is reviewed, could you follow up by posting some screenshots showing the change on the issue, and tag Devika for a look?

$this
->addDefaultFields($context)
->addReminderFields($context)
->addReminderDisbaleNoticeField($context);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*Disable

/**
* @file classes/form/validation/FormValidatorDateCompare.php
*
* Copyright (c) 2014-2021 Simon Fraser University
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2024 for new code.

{
parent::__construct(__('publication.jats.defaultContentCreationError'), null, $innerException);
parent::__construct(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still showing up in the PR.


public function __construct(DateTimeInterface|Carbon $comparingDate, string $comparingRule)
{
if (!in_array($comparingRule, static::getComparingRules())) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about using an Enum for this, instead of runtime validation? We've applied this to a few other places in the code, and so far I like it.

Copy link
Member Author

@touhidurabir touhidurabir Apr 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done refactoring to enum . I was not sure if we are using enums but as I see we are now, better to do that from now on rather than using constants .

}

if (!PKP_STRICT_MODE) {
class_alias('\PKP\validation\ValidatorDateComparison', '\ValidatorDateComparison');
Copy link
Member

@asmecher asmecher Apr 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need class aliases for new code -- only for backwards compatibility with old code. (As above)

{
parent::__construct();

$this->reviewAssignmentId = $reviewAssignmentId;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you're using promotion, there's no need to assign these in the constructor.

{
public function __construct(
public int $reviewAssignmentId,
public int $submissionId,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The $submissionId and $contextId can be derived from the review assignment; would it be better not to serialize them then have to check for discrepancies? (For example, later on we look at the $submissionId to fetch the submission from the database -- but there's no check to ensure it matches the submission ID in the review assignment. It would be better just to use the reviewAssignmentId, then get the submission ID etc. from that.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think thats better as we intend to keep the job serialized data as small as possible .

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However I think we need to set the standard to passing contextId whenever it's possible as our Services class bit too hard to mock.

@@ -205,6 +205,9 @@ msgstr "Email to be sent to reviewer"
msgid "editor.review.importantDates"
msgstr "Important Dates"

msgid "editor.review.importantDates.notice"
msgstr "Review due date must be greater or euqal to response due date."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*equal

@touhidurabir touhidurabir force-pushed the i5885_main branch 2 times, most recently from 2936c39 to ccbbc26 Compare April 24, 2024 11:49
@@ -205,8 +205,7 @@ protected function mockRequest($path = 'index/test-page/test-op', $userId = null
$request->setRouter($router);

// Test user.
$session = $request->getSession();
$session->setUserId($userId);
$request->getSessionGuard()->setUserId($userId);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a leftover from #9566. this and above in the function signature .

@@ -23,7 +23,7 @@
use PKP\invitation\invitations\enums\InvitationStatus;
use PKP\mail\variables\ReviewAssignmentEmailVariable;
use PKP\security\Validation;
use ReviewAssignment;
use PKP\submission\reviewAssignment\ReviewAssignment;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This proper namespace update is required for mocking

@touhidurabir
Copy link
Member Author

@asmecher can you take another look specifically at the commit test added for queue job . I have added some tests and at the same time I had to update in the core PKPTestCase .

@touhidurabir
Copy link
Member Author

@asmecher rebased and all tests are passing . please take a final look .

@touhidurabir touhidurabir force-pushed the i5885_main branch 2 times, most recently from b4b5fda to d4ad06b Compare July 1, 2024 07:17
msgstr ""
"Send an email reminder if a reviewer has not responded to a review request "
"this many days after the response due date."
"Send an email reminder before or after for review request response(if reviewer has not responded "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space before (

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

msgid "manager.setup.reviewOptions.reminders.submit"
msgstr "Review Reminder"
msgid "manager.setup.reviewOptions.reminders.response.before"
msgstr "Response Request Response - Before Due Date"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be "Review Request Response", not "Response Request Response"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

"Send an email reminder if a reviewer has not submitted a recommendation "
"within this many days after the review's due date."
msgid "manager.setup.reviewOptions.reminders.response.after"
msgstr "Response Request Response - After Due Date"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also here: should be "Review Request Response", not "Response Request Response"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

@asmecher asmecher merged commit 41b38eb into pkp:main Aug 30, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants