-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdebug_test.kt
More file actions
30 lines (25 loc) · 917 Bytes
/
debug_test.kt
File metadata and controls
30 lines (25 loc) · 917 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import io.litequest.demo.PaginatedViewModel
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonPrimitive
fun main() {
val viewModel = PaginatedViewModel()
// Update has-diabetes
viewModel.updateAnswer("has-diabetes", JsonPrimitive(true))
// Get the response and print structure
val response = viewModel.state.value.response
val json = Json { prettyPrint = true }
val jsonString = json.encodeToString(
io.litequest.model.QuestionnaireResponse.serializer(),
response
)
println("Response structure:")
println(jsonString)
// Also print the questionnaire structure
println("\nQuestionnaire items:")
response.items.forEach { item ->
println("- ${item.linkId} (has ${item.items.size} nested items)")
item.items.forEach { nested ->
println(" - ${nested.linkId}")
}
}
}