File tree Expand file tree Collapse file tree 3 files changed +6
-5
lines changed
kotlin/com/k0d4black/theforce Expand file tree Collapse file tree 3 files changed +6
-5
lines changed Original file line number Diff line number Diff line change 11package com.k0d4black.theforce.mappers
22
3+ import com.k0d4black.theforce.commons.convertToInches
34import com.k0d4black.theforce.domain.models.Character
45import com.k0d4black.theforce.domain.models.Film
56import com.k0d4black.theforce.domain.models.Planet
67import com.k0d4black.theforce.domain.models.Specie
8+ import com.k0d4black.theforce.models.CharacterPresentation
79import com.k0d4black.theforce.models.FilmPresentation
810import com.k0d4black.theforce.models.PlanetPresentation
911import com.k0d4black.theforce.models.SpeciePresentation
10- import com.k0d4black.theforce.models.CharacterPresentation
11- import com.k0d4black.theforce.commons.convertToInches
1212
1313
1414fun Character.toPresentation (): CharacterPresentation {
@@ -22,7 +22,8 @@ fun Character.toPresentation(): CharacterPresentation {
2222}
2323
2424fun Planet.toPresentation (): PlanetPresentation {
25- return PlanetPresentation (this .name, this .population)
25+ val populationAsLong = if (this .population.contains(" Unknown" )) 0L else this .population.toLong()
26+ return PlanetPresentation (this .name, populationAsLong)
2627}
2728
2829fun Film.toPresentation (): FilmPresentation {
Original file line number Diff line number Diff line change 11package com.k0d4black.theforce.models
22
3- data class PlanetPresentation (val name : String , val population : String )
3+ data class PlanetPresentation (val name : String , val population : Long )
Original file line number Diff line number Diff line change 2828
2929 <!-- Data Binding String Templates -->
3030 <string name =" template_planet_name" >Name : %s</string >
31- <string name =" template_planet_population" >Population : %s </string >
31+ <string name =" template_planet_population" >Population : %,d </string >
3232 <string name =" template_species_name" >Name : %s</string >
3333 <string name =" template_height_cm" >%s cm</string >
3434 <string name =" template_height_inches" >%s inches</string >
You can’t perform that action at this time.
0 commit comments