Skip to content

Conversation

@salmanm2003
Copy link
Contributor

This is for: #12035

Comment on lines 77 to 80
} elseif ($stageAssignment->getRecommendOnly()) {
if ($decisionType->getDecision() === Decision::NEW_EXTERNAL_ROUND) {
$isAllowed = true;
}
Copy link
Contributor

@jonasraoni jonasraoni Dec 5, 2025

Choose a reason for hiding this comment

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

I think all these ifs can be simplified into:

Suggested change
} elseif ($stageAssignment->getRecommendOnly()) {
if ($decisionType->getDecision() === Decision::NEW_EXTERNAL_ROUND) {
$isAllowed = true;
}
$decision = $decisionType->getDecision();
if (!$stageAssignment->getRecommendOnly() ||
$decision === Decision::NEW_EXTERNAL_ROUND ||
Repo::decision()->isRecommendation($decision)) {
$isAllowed = true;
break;
}

Copy link
Contributor

@jonasraoni jonasraoni Dec 5, 2025

Choose a reason for hiding this comment

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

In fact, after checking the other nearby lines, I think a lot of improvements should be added here:

  • The only purpose of the foreach loop seems to perhaps set the $isAllowed to true, therefore, a break can be added once the value is set to true...
  • On the lines 62 and 66: the else isn't needed and can be removed, a decreased indentation simplifies reading code.
  • Looks like the block ranging from line 84 until 96 has no dependency with the inner variables of the foreach loop, therefore, it doesn't need to be called many times (there's a query involved and this is expensive) and should be cached... (e.g. $cached ??= (function (){...})(); or using an extra private method)

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.

I'm ambivalent about this change -- if you were asking me about whether recommend-only users should be able to start a new round, I'd probably say no (not that I'm particularly informed about this aspect of workflow); however, this is a regression from 3.3.0, probably an accidental one made during refactor of editorial decisions. So I'm OK either way.

However, we probably should stay consistent in this decision between internal and external reviews (for OMP).

Copy link
Contributor

@jonasraoni jonasraoni left a comment

Choose a reason for hiding this comment

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

I've never touched this piece of code, but I've left a couple of suggestions, which I think are good to handle while there's someone touching this.

@salmanm2003
Copy link
Contributor Author

salmanm2003 commented Dec 16, 2025

@asmecher Since this is working fine in 3.4, could you please apply it to 3.4 for now and consider further improvements in later versions? I’ve just simplified the if statements as @jonasraoni suggested, while the remaining enhancements can be addressed for 3.5 and beyond.

@salmanm2003 salmanm2003 force-pushed the i12035_ojs_3_4_bug_recommend_only_editors_add_new_round branch from ead1ecf to 5d52581 Compare December 16, 2025 11:19
@asmecher
Copy link
Member

@salmanm2003, I'll leave that decision to @Vitaliy-1 as the workflow lead.

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.

4 participants