Skip to content

pkp/pkp-lib#11252 Calculate latest round withing latest stage #11316

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

Open
wants to merge 2 commits into
base: stable-3_5_0
Choose a base branch
from

Conversation

jardakotesovec
Copy link
Contributor

No description provided.

->on('ramax_stage.reviewer_id', '=', 'ramax_round.reviewer_id')
->on('ramax_stage.latest_stage', '=', 'ramax_round.stage_id');
})
->groupBy(['ramax_stage.submission_id', 'ramax_stage.latest_stage', 'ramax_stage.reviewer_id']),
Copy link
Contributor Author

@jardakotesovec jardakotesovec Apr 24, 2025

Choose a reason for hiding this comment

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

Here is the query for argmax.. as it might be easier to read:

LEFT JOIN (
    SELECT ramax_stage.submission_id,
           ramax_stage.reviewer_id,
           ramax_stage.latest_stage,
           MAX(ramax_round.round) AS latest_round
    FROM (
        SELECT ramax_stage_inner.reviewer_id,
               ramax_stage_inner.submission_id,
               MAX(ramax_stage_inner.stage_id) AS latest_stage
        FROM review_assignments AS ramax_stage_inner
        WHERE ramax_stage_inner.reviewer_id IN (9)
        GROUP BY ramax_stage_inner.submission_id,
                 ramax_stage_inner.reviewer_id
    ) AS ramax_stage
    INNER JOIN review_assignments AS ramax_round
        ON ramax_stage.submission_id = ramax_round.submission_id
        AND ramax_stage.reviewer_id = ramax_round.reviewer_id
        AND ramax_stage.latest_stage = ramax_round.stage_id
    GROUP BY ramax_stage.submission_id,
             ramax_stage.latest_stage,
             ramax_stage.reviewer_id
) AS agrmax

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.

1 participant