This commit is contained in:
Superdandan 2024-09-21 11:33:41 +08:00
parent 813ac0a228
commit 67345e2089
2 changed files with 15 additions and 6 deletions

View File

@ -4,9 +4,7 @@
<component name="GradleSettings"> <component name="GradleSettings">
<option name="linkedExternalProjectsSettings"> <option name="linkedExternalProjectsSettings">
<GradleProjectSettings> <GradleProjectSettings>
<option name="distributionType" value="LOCAL" />
<option name="externalProjectPath" value="$PROJECT_DIR$" /> <option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="$PROJECT_DIR$/../../develop/gradle-8.5-bin/gradle-8.5" />
<option name="modules"> <option name="modules">
<set> <set>
<option value="$PROJECT_DIR$" /> <option value="$PROJECT_DIR$" />

View File

@ -9,7 +9,8 @@ class Questionnaire(
val description: String, // 问卷的描述或说明 val description: String, // 问卷的描述或说明
val questions: List<SurveyQuestion>, val questions: List<SurveyQuestion>,
val questionGroup: List<QuestionGroup>, val questionGroup: List<QuestionGroup>,
val sample: SurveyBackgroundSample// 问卷中的所有问题 val sample: SurveyBackgroundSample, // 问卷中的所有问题
val procedures: List<SurveyProcedure>
) { ) {
private val selectedOptions: MutableMap<Long, MutableSet<Long>> = mutableMapOf()// Map of questionId to optionId private val selectedOptions: MutableMap<Long, MutableSet<Long>> = mutableMapOf()// Map of questionId to optionId
@ -248,17 +249,27 @@ class SurveyProcedure(
val targetQuestionId: Long, val targetQuestionId: Long,
val targetOptionId: Long, val targetOptionId: Long,
val computeMethod: ComputeMethod val computeMethod: ComputeMethod
) ) {
fun ifProcess(sourceOptionalId: Long, questionnaire: Questionnaire) {
if (sourceOptionalId == sourceOptionId) generateOptionDependency(questionnaire)
}
fun generateOptionDependency(questionnaire: Questionnaire): OptionDependency? {
return null
}
}
enum class ComputeMethod( enum class ComputeMethod(
val computeMethodName: String val computeMethodName: String
) { ) {
BaseComputeMethod("Default") { BaseComputeMethod("Default") {
override fun calculateEffectBasedOnOrder( override fun calculateEffectBasedOnOrder(
sourceOption: QuestionOption, influencedOption: QuestionOption,
targetOption: QuestionOption targetOption: QuestionOption
): Double { ): Double {
val orderDifference = abs(sourceOption.markOrder - targetOption.markOrder) val orderDifference = abs(influencedOption.markOrder - targetOption.markOrder)
return when (orderDifference) { return when (orderDifference) {
0 -> 1.0 0 -> 1.0
1 -> 0.7 1 -> 0.7