Skip to content

Instantly share code, notes, and snippets.

@Gazer
Created November 23, 2016 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gazer/9377ae32c97b4f644e79c04febcd4909 to your computer and use it in GitHub Desktop.
Save Gazer/9377ae32c97b4f644e79c04febcd4909 to your computer and use it in GitHub Desktop.
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