Skip to content

Instantly share code, notes, and snippets.

@Gazer Gazer/example1_refactor3.groovy Secret
Created Nov 23, 2016

Embed
What would you like to do?
class Exercise {
def unit() {
String unit = "min"
if (tags.contains("(floor_count)")) {
unit = "floors"
} else if (tags.contains("(step_count)")) {
unit = "steps"
}
}
}
class ExerciseEntry {
def unit() {
exercise.unit()
}
}
// Fragmento original refactorizado
resposeData.movement = dayEntry.exercisesEntries.collect { it ->
[
exercise_id: it.exerciseId,
value: it.minutes,
unit: it.unit()
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.