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

fix: Use createDate as secundary order param [DHIS2-18093] #139

Merged
merged 4 commits into from
Oct 4, 2024

Conversation

enricocolasante
Copy link
Collaborator

@enricocolasante enricocolasante commented Oct 2, 2024

  • Introducing API breaking changes
  1. Remove eventDate and programStage fields from RuleDataValue. These values are deduced from RuleEvent
  2. Add createdDate field in RuleEvent.

Refactor RuleVariableValueMapBuilder to remove most of MutableMaps and !! operator.

@vgarciabnz Would be difficult to add a formatted plugin to the repository?

The correct version should be 3.1.0? As we introduced breaking changes?

@enricocolasante enricocolasante marked this pull request as ready for review October 4, 2024 08:15
val value = currentEventValues[field]
val optionValue = if (useCodeForOptionSet) value!!.value else getOptionName(value!!.value)!!
RuleVariableValue(
fieldType, optionValue,
listOf(optionValue), getLastUpdateDate(listOf(value))
)
listOf(optionValue), ruleEvent!!.eventDate.toLocalDateTime(TimeZone.currentSystemDefault()).date.toString())
Copy link
Member

Choose a reason for hiding this comment

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

Just a comment, not necessarily something to change now. In general, I will try to avoid the use of !! because it just throws a NPE without any other information. Something such as
requireNotNull(ruleEvent) { "Event must not be null in CurrentEvent variables" }
might be more meaningful.

@vgarciabnz
Copy link
Member

I would say the right version should be 3.1.0 at least. If we wanted to be very strict, maybe it should even be 4.0.0 because of the breaking changes

Copy link
Contributor

@jbee jbee left a comment

Choose a reason for hiding this comment

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

I don't know enough about RE to judge the semantics of this change but on the code level this looks good 👍

@enricocolasante
Copy link
Collaborator Author

I would say the right version should be 3.1.0 at least. If we wanted to be very strict, maybe it should even be 4.0.0 because of the breaking changes

I would go with 3.1.0. The API is not mature yet, we may end up to a high number really quick

@vgarciabnz
Copy link
Member

About format plugins, the android sdk uses two plugins that could be easily added in this repo, not necessarily both of them (actually they overlap a little bit):

  • ktlint: mainly checks the format
  • detekt: it is a static code analyzer

@enricocolasante enricocolasante merged commit 5fa1af7 into master Oct 4, 2024
2 checks passed
@enricocolasante enricocolasante deleted the DHIS2-18093 branch October 4, 2024 12:11
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.

3 participants