Skip to content

Commit 056112a

Browse files
authored
Fix IGDB API schema inconsistencies (#249)
1 parent bd49522 commit 056112a

File tree

28 files changed

+394
-79
lines changed

28 files changed

+394
-79
lines changed

common-data/src/main/java/com/paulrybitskyi/gamedge/common/data/games/datastores/database/DbGameMapper.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ internal class DbGameMapper @Inject constructor() {
6161
fun mapToDomainGame(dbGame: DbGame): Game {
6262
return Game(
6363
id = dbGame.id,
64-
followerCount = dbGame.followerCount,
6564
hypeCount = dbGame.hypeCount,
6665
releaseDate = dbGame.releaseDate,
6766
criticsRating = dbGame.criticsRating,
@@ -217,7 +216,6 @@ internal class DbGameMapper @Inject constructor() {
217216
fun mapToDatabaseGame(domainGame: Game): DbGame {
218217
return DbGame(
219218
id = domainGame.id,
220-
followerCount = domainGame.followerCount,
221219
hypeCount = domainGame.hypeCount,
222220
releaseDate = domainGame.releaseDate,
223221
criticsRating = domainGame.criticsRating,

common-data/src/main/java/com/paulrybitskyi/gamedge/common/data/games/datastores/igdb/IgdbGameMapper.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ internal class IgdbGameMapper @Inject constructor() {
5757
fun mapToDomainGame(apiGame: ApiGame): Game {
5858
return Game(
5959
id = apiGame.id,
60-
followerCount = apiGame.followerCount,
6160
hypeCount = apiGame.hypeCount,
6261
releaseDate = apiGame.releaseDate,
6362
criticsRating = apiGame.criticsRating,

common-domain/src/main/java/com/paulrybitskyi/gamedge/common/domain/games/entities/AgeRatingType.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ package com.paulrybitskyi.gamedge.common.domain.games.entities
1818

1919
enum class AgeRatingType(val title: String) {
2020
UNKNOWN(title = ""),
21-
THREE(title = "3"),
22-
SEVEN(title = "7"),
23-
TWELVE(title = "12"),
24-
SIXTEEN(title = "16"),
25-
EIGHTEEN(title = "18"),
2621
RP(title = "RP"),
2722
EC(title = "EC"),
2823
E(title = "E"),
2924
E10(title = "E10"),
3025
T(title = "T"),
3126
M(title = "M"),
3227
AO(title = "AO"),
28+
THREE(title = "3"),
29+
SEVEN(title = "7"),
30+
TWELVE(title = "12"),
31+
SIXTEEN(title = "16"),
32+
EIGHTEEN(title = "18"),
3333
}

common-domain/src/main/java/com/paulrybitskyi/gamedge/common/domain/games/entities/Game.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package com.paulrybitskyi.gamedge.common.domain.games.entities
1818

1919
data class Game(
2020
val id: Int,
21-
val followerCount: Int?,
2221
val hypeCount: Int?,
2322
val releaseDate: Long?,
2423
val criticsRating: Double?,

common-testing-domain/src/main/java/com/paulrybitskyi/gamedge/common/testing/domain/FakeData.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import com.paulrybitskyi.gamedge.common.domain.games.entities.Game
2323

2424
val DOMAIN_GAME = Game(
2525
id = 1,
26-
followerCount = null,
2726
hypeCount = null,
2827
releaseDate = null,
2928
criticsRating = null,

core/src/main/java/com/paulrybitskyi/gamedge/core/GameLikeCountCalculator.kt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ interface GameLikeCountCalculator {
2828
internal class GameLikeCountCalculatorImpl @Inject constructor() : GameLikeCountCalculator {
2929

3030
override fun calculateLikeCount(game: Game): Int {
31-
val followerCount = (game.followerCount ?: 0)
32-
val hypeCount = (game.hypeCount ?: 0)
33-
val likeCount = (followerCount + hypeCount)
34-
35-
return likeCount
31+
return game.hypeCount ?: 0
3632
}
3733
}

core/src/test/java/com/paulrybitskyi/gamedge/core/GameLikeCountCalculatorImplTest.kt

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,29 +31,15 @@ internal class GameLikeCountCalculatorImplTest {
3131
}
3232

3333
@Test
34-
fun `Calculates like count properly when both follower count and hype count fields are not null`() {
35-
val game = DOMAIN_GAME.copy(followerCount = 20, hypeCount = 10)
34+
fun `Calculates like count properly when hype count field is not null`() {
35+
val game = DOMAIN_GAME.copy(hypeCount = 10)
3636

37-
assertThat(SUT.calculateLikeCount(game)).isEqualTo(30)
38-
}
39-
40-
@Test
41-
fun `Calculates like count properly when follower count field is null`() {
42-
val game = DOMAIN_GAME.copy(followerCount = null, hypeCount = 50)
43-
44-
assertThat(SUT.calculateLikeCount(game)).isEqualTo(50)
37+
assertThat(SUT.calculateLikeCount(game)).isEqualTo(10)
4538
}
4639

4740
@Test
4841
fun `Calculates like count properly when hype count field is null`() {
49-
val game = DOMAIN_GAME.copy(followerCount = 70, hypeCount = null)
50-
51-
assertThat(SUT.calculateLikeCount(game)).isEqualTo(70)
52-
}
53-
54-
@Test
55-
fun `Calculates like count properly when both follower count and hype count fields are null`() {
56-
val game = DOMAIN_GAME.copy(followerCount = null, hypeCount = null)
42+
val game = DOMAIN_GAME.copy(hypeCount = null)
5743

5844
assertThat(SUT.calculateLikeCount(game)).isEqualTo(0)
5945
}

0 commit comments

Comments
 (0)