|
|
@@ -339,7 +339,7 @@ func ParseQuestionExcel(skillId int, operateBy string, b []byte) ([]learning.Lea
|
|
|
return nil, fmt.Errorf("excel 格式错误:不合法的题型 '%s' %d", typeStr, rown)
|
|
|
}
|
|
|
|
|
|
- answerStr := strings.TrimSpace(row[7])
|
|
|
+ answerStr := strings.ToUpper(strings.TrimSpace(row[7]))
|
|
|
answer := strings.Split(answerStr, " ")
|
|
|
for i := range answer {
|
|
|
pass := false
|
|
|
@@ -354,27 +354,34 @@ func ParseQuestionExcel(skillId int, operateBy string, b []byte) ([]learning.Lea
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- options := []learning.LearningQuestionOption{
|
|
|
- {
|
|
|
+ options := []learning.LearningQuestionOption{}
|
|
|
+ if a != "" {
|
|
|
+ options = append(options, learning.LearningQuestionOption{
|
|
|
Name: "A",
|
|
|
Content: a,
|
|
|
IsCorrect: strings.Contains(answerStr, "A"),
|
|
|
- },
|
|
|
- {
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if b != "" {
|
|
|
+ options = append(options, learning.LearningQuestionOption{
|
|
|
Name: "B",
|
|
|
Content: b,
|
|
|
IsCorrect: strings.Contains(answerStr, "B"),
|
|
|
- },
|
|
|
- {
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if c != "" {
|
|
|
+ options = append(options, learning.LearningQuestionOption{
|
|
|
Name: "C",
|
|
|
Content: c,
|
|
|
IsCorrect: strings.Contains(answerStr, "C"),
|
|
|
- },
|
|
|
- {
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if d != "" {
|
|
|
+ options = append(options, learning.LearningQuestionOption{
|
|
|
Name: "D",
|
|
|
Content: d,
|
|
|
IsCorrect: strings.Contains(answerStr, "D"),
|
|
|
- },
|
|
|
+ })
|
|
|
}
|
|
|
correctCount := 0
|
|
|
for _, o := range options {
|