Skip to content

Commit

Permalink
by lazy error fixed, not a clue what has happened with this commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dawsson committed Jul 1, 2024
1 parent c4a15f5 commit f0fb729
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ data class Plugin(
@SerializedName("_id")
val id: String,
val name: String,
val platforms: Map<MarketplacePlatform, PlatformPlugin>,
val platforms: MutableMap<MarketplacePlatform, PlatformPlugin>,
) {

val highestPriorityPlatform get() = MarketplacePlatform.entries.find(platforms::containsKey) ?: platforms.keys.first()

val downloadableName = name.replace(Regex("[/\\\\]"), "")

val downloadableName get() = name.replace("/", "")
.replace("\\", "")

fun getFirstPlatform(): PlatformPlugin? = platforms.values.firstOrNull()

Expand All @@ -33,9 +31,7 @@ data class Plugin(
}
}

val totalDownloads by lazy {
platforms.values.sumOf { it.downloads }
}
val totalDownloads: Int get() = platforms.values.sumOf { platform -> platform.downloads }
}

data class PlatformPlugin(
Expand Down

0 comments on commit f0fb729

Please sign in to comment.