Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove custom today XPath function #7821

Merged
merged 5 commits into from
Oct 4, 2022
Merged

Remove custom today XPath function #7821

merged 5 commits into from
Oct 4, 2022

Conversation

jkuester
Copy link
Contributor

@jkuester jkuester commented Sep 23, 2022

Description

This PR removes our custom today XPath function (allowing us to inherit the default functionality from the OpenRosa today function. The difference is that our custom implementation of today would include the current time value while OpenRosa's default implementation (which matches JavaRosa) is that today only returns today's date at midnight in the current timezone.

Form changes:

In places where we were using today, If we do not actually care about the time value, I just let it be. If it seemed like the time value might be relevant, I switched to use now. When today was being wrapped with a floor call, I just removed the floor since it should no longer be necessary (see the discussion on the issue for more details about this). Finally, I also tried to remove unnecessary calls to decimal-date-time as I went. We were using these a lot when comparing date values, but this is unnecessary. (Enketo supports comparing date values with <>=. They do not have to be converted to numbers.)

Closes #7731

Code review checklist

  • Readable: Concise, well named, follows the style guide, documented if necessary.
  • Tested: Unit and/or e2e where appropriate
  • Backwards compatible: Works with existing data and configuration or includes a migration. Any breaking changes documented in the release notes.

License

The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.

@jkuester jkuester requested a review from njogz September 27, 2022 14:49
@jkuester jkuester marked this pull request as ready for review September 27, 2022 14:49
Copy link
Contributor

@njogz njogz left a comment

Choose a reason for hiding this comment

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

Great job on this! Is there another issue where we are keeping track of Enketo behaviour changes that app builders should be aware of and how to overcome them?

@jkuester
Copy link
Contributor Author

@njogz good call. I don't think there is an issue, but I will be sure to include this in the documentation changes we are adding in medic/cht-docs#802

@jkuester jkuester changed the title Remove custom today xpath function and unit tests Remove custom today XPath function Oct 4, 2022
@jkuester jkuester merged commit 7214225 into master Oct 4, 2022
@jkuester jkuester deleted the 7731_refactor_today branch October 4, 2022 16:04
jkuester added a commit that referenced this pull request Oct 5, 2022
jkuester added a commit that referenced this pull request Oct 17, 2022
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.

Update today XPath function to not return current time
2 participants