Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Commit

Permalink
Throw error if result doesn't implement AssessmentResult or JsonFileA…
Browse files Browse the repository at this point in the history
…rchivableResult.
  • Loading branch information
nategbrown9 committed Nov 21, 2023
1 parent 7151412 commit 51a0746
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ class AssessmentArchiver(
private var answersSchema: SimpleJsonSchema

init {
if (assessmentResult !is AssessmentResult && assessmentResult !is JsonFileArchivableResult) {
throw IllegalArgumentException("Result must implement either AssessmentResult or JsonFileArchivableResult")
}
val appVersion = "version ${bridgeConfig.appVersionName}, build ${bridgeConfig.appVersion}"
val item = assessmentResult.identifier
archiveBuilder = Archive.Builder.forActivity(item)
Expand All @@ -54,7 +57,7 @@ class AssessmentArchiver(
// Iterate through all the results within this collection and add if they are `JsonFileArchivableResult`.
recursiveAdd(assessmentResult)
// Add assessment result file to archive
if (assessmentResult is AssessmentResult && assessmentResult !is JsonFileArchivableResult) {
if (assessmentResult is AssessmentResult) {
val assessmentResultFilename = "assessmentResult.json"
Logger.d("Writing result for assessment ${assessmentResult.identifier}")
archiveBuilder.addDataFile(
Expand Down

0 comments on commit 51a0746

Please sign in to comment.