Skip to content

Error in calculation of maxSequence #114

Description

@t-mayer

Hi,
after upgrading to from OJS 3.3 to OJS 3.4 we noticed that the maxSequence calculation in the for loop always uses the current publication instead of the publication of the submissions it is iterating over:

   if (count($otherSubmissionsInSection)) {
             $maxSequence = 0;
                foreach ($otherSubmissionsInSection as $submission) {
                    if ($publication->getData('seq')) {
                        $maxSequence = max($maxSequence, $publication->getData('seq'));
                    }
                }
                $publication->setData('seq', $maxSequence + 1);
            }

            Repo::publication()->publish($publication);
        }

Instead it should be (I guess):

if (count($otherSubmissionsInSection)) {
                $maxSequence = 0;
                foreach ($otherSubmissionsInSection as $submission) {
                    if ($submission->getCurrentPublication()->getData('seq')) {
                        $maxSequence = max($maxSequence, $submission->getCurrentPublication()->getData('seq'));
                    }
                }
                $publication->setData('seq', $maxSequence + 1);
            }

Compare to OJS 3.3:

if (count($otherSubmissionsInSection)) {
				$maxSequence = 0;
				foreach ($otherSubmissionsInSection as $submission) {
					if ($submission->getCurrentPublication()->getData('seq')) {
						$maxSequence = max($maxSequence, $submission->getCurrentPublication()->getData('seq'));
					}
				}
				$publication->setData('seq', $maxSequence + 1);
			}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions