-
Notifications
You must be signed in to change notification settings - Fork 82
improve: Export form id and version to fix #236 #239
Conversation
* Timestamped form slug becomes now form version * Sanitized form title component of form slug becomes form id * Updated deps in Gemfile
Aha, CircleCI is not happy with my newer Ruby version. Using the version pinned in CircleCI (2.3.3):
Seeing there's almost no test coverage to pick up any regression bugs (not judging!), it feels rude to sneak a Ruby version upgrade into this PR, so I'll try and keep versions as is. Reverting my commit to the Gemfile and pushing shortly. |
I'm happy to submit this PR for review now. The big question is: which use cases break if the form ID follows the form title. |
@@ -346,7 +346,7 @@ var dataNS = odkmaker.namespace.load('odkmaker.data'); | |||
|
|||
// create binding based on kind | |||
var kind = control.kind.toLowerCase(); | |||
if (kind == 'device id') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, that's me editor deleting trailing whitespace on file save. Hope that's OK to submit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if this were an active project i'd grouse but as is it's totally fine.
public/javascripts/data.js
Outdated
@@ -706,8 +706,7 @@ var dataNS = odkmaker.namespace.load('odkmaker.data'); | |||
name: 'data', | |||
attrs: { | |||
'id': $.sanitizeString($('.header h1').text()), | |||
'version': 'build_' + $.sanitizeString($('.header h1').text()) + | |||
'_' + Math.round((new Date()).getTime() / 1000) | |||
'version': Math.round((new Date()).getTime() / 1000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressing #236 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Version needs to be '' + Math.round to become a string else XML export fails when it gets the date hash as number.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i might mildly prefer String(Math.round(…))
over '' +
but tbh the latter is probably the more common pattern anyway.
@lognaturel I'm happy to submit this two-line PR for review now, XML exports form id (sanitized title) and version (string of date hash). XLSForm export will need getodk/build2xlsform#14 to adjust behaviour. |
* Sanitized form title becomes form_id * user_version or date hash becomes version * version now always included * tests updated * This behaviour mirrors getodk/build#239
Resolves getodk#239 (comment) Mild preferences are still preferences
This PR closes #236
<data id="Untitled-Form" version="build_Untitled-Form_1606880517">
<h:title>Test 123!@# 123#$%5</h:title>
becomes<data id="Test-123-123-5" version="build_Test-123-123-5_1606880579">
This change is![Reviewable](https://camo.githubusercontent.com/23b05f5fb48215c989e92cc44cf6512512d083132bd3daf689867c8d9d386888/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)