From f0fb72930331c230333451a90db1f913abdd923b Mon Sep 17 00:00:00 2001 From: Dawson Date: Mon, 1 Jul 2024 19:25:07 -0400 Subject: [PATCH] by lazy error fixed, not a clue what has happened with this commit. --- .../gg/flyte/pluginportal/common/types/Plugin.kt | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/common/src/main/kotlin/gg/flyte/pluginportal/common/types/Plugin.kt b/common/src/main/kotlin/gg/flyte/pluginportal/common/types/Plugin.kt index a1e239b..0b5e136 100644 --- a/common/src/main/kotlin/gg/flyte/pluginportal/common/types/Plugin.kt +++ b/common/src/main/kotlin/gg/flyte/pluginportal/common/types/Plugin.kt @@ -6,13 +6,11 @@ data class Plugin( @SerializedName("_id") val id: String, val name: String, - val platforms: Map, + val platforms: MutableMap, ) { - 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() @@ -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(