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#10662 Fix isOverdue query #10808

Merged
merged 1 commit into from
Jan 15, 2025

Conversation

taslangraham
Copy link
Contributor

@taslangraham taslangraham commented Jan 15, 2025

For #10662

Comment on lines 389 to 426
if ($this->isOverdue) {
$q->leftJoin('review_assignments as raod', 'raod.submission_id', '=', 's.submission_id')
->leftJoin('review_rounds as rr', fn (Builder $table) =>
$table->on('rr.submission_id', '=', 's.submission_id')
->on('raod.review_round_id', '=', 'rr.review_round_id')
);
// Only get overdue assignments on active review rounds
$q->whereNotIn('rr.status', [
ReviewRound::REVIEW_ROUND_STATUS_RESUBMIT_FOR_REVIEW,
ReviewRound::REVIEW_ROUND_STATUS_SENT_TO_EXTERNAL,
ReviewRound::REVIEW_ROUND_STATUS_ACCEPTED,
ReviewRound::REVIEW_ROUND_STATUS_DECLINED,
]);
$q->where(fn (Builder $q) =>
$q->where('raod.declined', '<>', 1)
->where('raod.cancelled', '<>', 1)
->where(fn (Builder $q) =>
$q->where('raod.date_due', '<', Core::getCurrentDate(strtotime('tomorrow')))
->whereNull('raod.date_completed')
$q->whereIn(
's.submission_id',
fn (Builder $q) =>
$q->select('s.submission_id')
->from('submissions AS s')
->leftJoin('review_assignments as raod', 'raod.submission_id', '=', 's.submission_id')
->leftJoin(
'review_rounds as rr',
fn (Builder $table) =>
$table->on('rr.submission_id', '=', 's.submission_id')
->on('raod.review_round_id', '=', 'rr.review_round_id')
)
->orWhere(fn (Builder $q) =>
$q->where('raod.date_response_due', '<', Core::getCurrentDate(strtotime('tomorrow')))
->whereNull('raod.date_confirmed')
->whereNotIn('rr.status', [
ReviewRound::REVIEW_ROUND_STATUS_RESUBMIT_FOR_REVIEW,
ReviewRound::REVIEW_ROUND_STATUS_SENT_TO_EXTERNAL,
ReviewRound::REVIEW_ROUND_STATUS_ACCEPTED,
ReviewRound::REVIEW_ROUND_STATUS_DECLINED,
])
->where(
fn (Builder $q) =>
$q->where('raod.declined', '<>', 1)
->where('raod.cancelled', '<>', 1)
->where(
fn (Builder $q) =>
$q->where('raod.date_due', '<', Core::getCurrentDate(strtotime('tomorrow')))
->whereNull('raod.date_completed')
)
->orWhere(
fn (Builder $q) =>
$q->where('raod.date_response_due', '<', Core::getCurrentDate(strtotime('tomorrow')))
->whereNull('raod.date_confirmed')
)
)
);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The formatter made quite a few changes to the file, but these are the lines specific to the issue at hand

@taslangraham taslangraham marked this pull request as ready for review January 15, 2025 16:27
@asmecher asmecher merged commit cc3f823 into pkp:stable-3_4_0 Jan 15, 2025
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.

2 participants