excell print score

This commit is contained in:
skeris 2024-10-24 01:07:29 +03:00
parent 02ce04cdd0
commit 205bcf2b42
3 changed files with 18 additions and 1 deletions

2
go.mod

@ -20,7 +20,7 @@ require (
google.golang.org/grpc v1.64.0
google.golang.org/protobuf v1.34.2
penahub.gitlab.yandexcloud.net/backend/penahub_common v0.0.0-20240607202348-efe5f2bf3e8c
penahub.gitlab.yandexcloud.net/backend/quiz/common.git v0.0.0-20240912142442-58e924bf7e4f
penahub.gitlab.yandexcloud.net/backend/quiz/common.git v0.0.0-20241024000054-49a7b4b41fe1
penahub.gitlab.yandexcloud.net/backend/quiz/worker.git v0.0.0-20240421230341-0e086fcbb990
penahub.gitlab.yandexcloud.net/external/trashlog v0.1.5
)

2
go.sum

@ -291,6 +291,8 @@ penahub.gitlab.yandexcloud.net/backend/quiz/common.git v0.0.0-20240909222600-fad
penahub.gitlab.yandexcloud.net/backend/quiz/common.git v0.0.0-20240909222600-fad3296f337e/go.mod h1:nfZkoj8MCYaoP+xiPeUn5D0lIzinUr1qDkNfX0ng9rk=
penahub.gitlab.yandexcloud.net/backend/quiz/common.git v0.0.0-20240912142442-58e924bf7e4f h1:lqPXp/EuPR6pkKTR5yZ+nGoFpxxqD7XGUJrIbuay+jo=
penahub.gitlab.yandexcloud.net/backend/quiz/common.git v0.0.0-20240912142442-58e924bf7e4f/go.mod h1:nfZkoj8MCYaoP+xiPeUn5D0lIzinUr1qDkNfX0ng9rk=
penahub.gitlab.yandexcloud.net/backend/quiz/common.git v0.0.0-20241024000054-49a7b4b41fe1 h1:6hrffZW1XHW1fBhwxj4EUCrp5AIL4Qa61neuVxSVTXA=
penahub.gitlab.yandexcloud.net/backend/quiz/common.git v0.0.0-20241024000054-49a7b4b41fe1/go.mod h1:uOuosXduBzd2WbLH6TDZO7ME7ZextulA662oZ6OsoB0=
penahub.gitlab.yandexcloud.net/backend/quiz/worker.git v0.0.0-20240421230341-0e086fcbb990 h1:jiO8GWO+3sCnDAV8/NAV8tQIUwae/I6/xiDilW7zf0o=
penahub.gitlab.yandexcloud.net/backend/quiz/worker.git v0.0.0-20240421230341-0e086fcbb990/go.mod h1:zswBuTwmEsFHBVRu1nkG3/Fwylk5Vcm8OUm9iWxccSE=
penahub.gitlab.yandexcloud.net/external/trashlog v0.1.5 h1:amsK0bkSJxBisk334aFo5ZmVPvN1dBT0Sv5j3V5IsT8=

@ -163,6 +163,21 @@ func WriteDataToExcel(buffer io.Writer, questions []model.Question, answers []mo
}
}
count++
} else if q.Type == model.TypeResult {
index := binarySearch(response, q.Id)
if index != -1 {
content := response[index].Content
score , err := strconv.ParseInt(content, 10, 64)
if err != nil {
continue
}
cell := ToAlphaString(count) + strconv.Itoa(row)
if err := file.SetCellValue(sheet, cell, score); err != nil {
fmt.Println(err.Error())
}
count++
}
}
}
cell := ToAlphaString(len(headers)) + strconv.Itoa(row)