Skip to content

Commit

Permalink
moving args around
Browse files Browse the repository at this point in the history
  • Loading branch information
ktuite committed Oct 10, 2024
1 parent 040b6d0 commit 0378d39
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/model/frames/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ class Form extends Frame.define(
.then((partial) => partial.with({ key: Option.of(key) }));
}

async withUpgradeEntityVersion() {
const xml = await updateEntityForm(this.xml, '2023.1.0', '2024.1.0', '_upgrade');
async withUpgradeEntityVersion(oldVersion, newVersion, suffix) {
const xml = await updateEntityForm(this.xml, oldVersion, newVersion, suffix);
// If the XML doesnt change (not the version in question, or a parsing error), don't return the new partial Form
if (xml === this.xml)
return null;
Expand Down
4 changes: 2 additions & 2 deletions lib/worker/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ const updateEntitiesVersion = async ({ Forms }, event) => {
const { projectId, xmlFormId } = await Forms.getByActeeIdForUpdate(event.acteeId).then(o => o.get());
const publishedVersion = await Forms.getByProjectAndXmlFormId(projectId, xmlFormId, true, Form.PublishedVersion).then(o => o.orNull());
if (publishedVersion && publishedVersion.currentDefId != null) {
const partial = await publishedVersion.withUpgradeEntityVersion();
const partial = await publishedVersion.withUpgradeEntityVersion('2023.1.0', '2024.1.0', '_upgrade');
if (partial != null)
await Forms.createVersion(partial, publishedVersion, true, true);
}

const draftVersion = await Forms.getByProjectAndXmlFormId(projectId, xmlFormId, true, Form.DraftVersion).then(o => o.orNull());
if (draftVersion && draftVersion.draftDefId != null) {
const partial = await draftVersion.withUpgradeEntityVersion();
const partial = await draftVersion.withUpgradeEntityVersion('2023.1.0', '2024.1.0', '_upgrade');
// update xml and version in place
if (partial != null)
await Forms._updateDef(draftVersion.def, { xml: partial.xml, version: partial.def.version });
Expand Down

0 comments on commit 0378d39

Please sign in to comment.