Skip to content

Commit 3cadf5c

Browse files
committed
Fix wrong version being used in imported test results
1 parent 46a7c89 commit 3cadf5c

3 files changed

Lines changed: 13 additions & 7 deletions

File tree

base/src/main/kotlin/org/sinytra/probe/base/RestAPI.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ data class TestEnvironmentDTO(
3636
@Serializable
3737
data class TestResponseBody(
3838
val modid: String?,
39-
val iconUrl: String,
39+
val iconUrl: String?,
4040
val projectUrl: String,
41-
val version: String,
41+
val version: String?,
4242
val passing: Boolean,
4343
val environment: TestEnvironmentDTO,
4444
val createdAt: LocalDateTime,

discord/src/main/kotlin/CheckCompatCommandBase.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ abstract class CheckCompatCommandBase {
8484
color = if (result.passing) green else red
8585
url = link
8686
thumbnail {
87-
url = result.iconUrl
87+
url = result.iconUrl ?: ""
8888
}
8989

9090
field {
@@ -101,7 +101,7 @@ abstract class CheckCompatCommandBase {
101101
}
102102
field {
103103
name = "Mod version"
104-
value = result.version
104+
value = result.version ?: "unknown"
105105
inline = true
106106
}
107107
field {

service/src/main/kotlin/org/sinytra/probe/service/Routing.kt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ fun Application.configureRouting(
9090

9191
val response = TestResponseBody(
9292
result.modid,
93-
project.iconUrl ?: "",
93+
project.iconUrl,
9494
project.url,
95-
version?.versionNumber ?: "unknown",
95+
version?.versionNumber,
9696
result.passing,
9797
envDto,
9898
result.createdAt,
@@ -133,7 +133,13 @@ fun Application.configureRouting(
133133
val project = platforms.getProject(ProjectPlatform.MODRINTH, res.project.slug)
134134
?: return@async null
135135

136-
return@async persistence.saveResult(project, res.result!!.output.primaryModid, res.versionNumber, res.result!!.output.success, testEnvironment)
136+
return@async persistence.saveResult(
137+
project,
138+
res.result!!.output.primaryModid,
139+
res.project.versionId,
140+
res.result!!.output.success,
141+
testEnvironment
142+
)
137143
} catch (ex: Exception) {
138144
LOGGER.error("Error importing result", ex)
139145
return@async null

0 commit comments

Comments
 (0)