Skip to content

Commit

Permalink
Deal with first create action in a branch
Browse files Browse the repository at this point in the history
  • Loading branch information
ktuite committed Jun 12, 2024
1 parent 740235d commit d714244
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/model/query/entities.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,8 @@ const _processSubmissionEvent = (event, parentEvent) => async ({ Audits, Dataset

// Check for held submissions that follow this one in the same branch
if (entityData.system.branchId != null) {
const currentBaseVersion = parseInt(entityData.system.baseVersion, 10);
// baseVersion could be '', meaning its a create
const currentBaseVersion = entityData.system.baseVersion === '' ? 1 : parseInt(entityData.system.baseVersion, 10);
const nextSub = await _checkHeldSubmission(maybeOne, entityData.system.branchId, currentBaseVersion + 1);
if (nextSub.isDefined()) {
const { submissionId: nextSubmissionId, submissionDefId: nextSubmissionDefId } = nextSub.get();
Expand Down

0 comments on commit d714244

Please sign in to comment.