!27 chen commit

Merge pull request !27 from chenh1/frontend
This commit is contained in:
Ontheway123 2021-09-25 16:06:56 +00:00 committed by Gitee
commit 5c26f83a25
10 changed files with 168 additions and 23 deletions

View File

@ -2,12 +2,16 @@
<project version="4">
<component name="ChangeListManager">
<list default="true" id="90d49d24-cd7e-4f14-b075-c6e5fe5ae2ce" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/controllers/Administrator.go" beforeDir="false" afterPath="$PROJECT_DIR$/controllers/Administrator.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/controllers/score.go" beforeDir="false" afterPath="$PROJECT_DIR$/controllers/score.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/controllers/supervisor.go" beforeDir="false" afterPath="$PROJECT_DIR$/controllers/supervisor.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lastupdate.tmp" beforeDir="false" afterPath="$PROJECT_DIR$/lastupdate.tmp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/web/src/views/Group/mark_monitor/all/index.jsx" beforeDir="false" afterPath="$PROJECT_DIR$/web/src/views/Group/mark_monitor/all/index.jsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/web/src/views/Group/test_monitor/arbitration/index.less" beforeDir="false" afterPath="$PROJECT_DIR$/web/src/views/Group/test_monitor/arbitration/index.less" afterDir="false" />
<change beforePath="$PROJECT_DIR$/web/src/views/Group/test_monitor/markTasks/index.jsx" beforeDir="false" afterPath="$PROJECT_DIR$/web/src/views/Group/test_monitor/markTasks/index.jsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/web/src/views/Group/test_monitor/problem/index.less" beforeDir="false" afterPath="$PROJECT_DIR$/web/src/views/Group/test_monitor/problem/index.less" afterDir="false" />
<change beforePath="$PROJECT_DIR$/web/src/views/Mark/Answer/index.jsx" beforeDir="false" afterPath="$PROJECT_DIR$/web/src/views/Mark/Answer/index.jsx" afterDir="false" />
<change beforePath="$PROJECT_DIR$/models/testPaper.go" beforeDir="false" afterPath="$PROJECT_DIR$/models/testPaper.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/models/testPaperInfo.go" beforeDir="false" afterPath="$PROJECT_DIR$/models/testPaperInfo.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/models/underCorrectedPaper.go" beforeDir="false" afterPath="$PROJECT_DIR$/models/underCorrectedPaper.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/requests/admin.go" beforeDir="false" afterPath="$PROJECT_DIR$/requests/admin.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/responses/supervisor.go" beforeDir="false" afterPath="$PROJECT_DIR$/responses/supervisor.go" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -181,6 +185,20 @@
<integration-enabled>true</integration-enabled>
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/controllers/score.go</url>
<line>708</line>
<option name="timeStamp" value="3" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DlvLineBreakpoint">
<url>file://$PROJECT_DIR$/controllers/supervisor.go</url>
<line>1447</line>
<option name="timeStamp" value="4" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
<watches-manager>
<configuration name="GoApplicationRunConfiguration">
<watch expression="*(*&quot;[]string&quot;)(824637671088)" />

View File

@ -915,3 +915,54 @@ func (c *AdminApiController) DistributionRecord() {
/**
试卷删除
*/
func (c *AdminApiController) DeleteTest(){
defer c.ServeJSON()
var requestBody requests.DeleteTest
var resp Response
var err error
err =json.Unmarshal(c.Ctx.Input.RequestBody, &requestBody)
if err!=nil {
log.Println(err)
resp = Response{"10001","cannot unmarshal",err}
c.Data["json"] = resp
return
}
//adminId := requestBody.AdminId
questionId := requestBody.QuestionId
//----------------------------------------------------
count, err := models.CountUnScoreTestNumberByQuestionId(questionId)
if count==0 {
models.DeleteAllTest(questionId)
subTopics:=make([]models.SubTopic,0)
models.FindSubTopicsByQuestionId(questionId,&subTopics)
for j:=0 ;j<len(subTopics);j++ {
subTopic:= subTopics[j]
testPaperInfos :=make([]models.TestPaperInfo,0)
models.FindTestPaperInfoByQuestionDetailId(subTopic.Question_detail_id,&testPaperInfos)
for k:=0;k<len(testPaperInfos);k++ {
//imgSrc :=testPaperInfos[k].Pic_src
//删除图片
testPaperInfos[k].Delete()
}
}
}else {
resp = Response{"30030","试卷未批改完不能删除 ",err}
c.Data["json"] = resp
return
}
//----------------------------------------------------
data := make(map[string]interface{})
data["data"] =nil
resp = Response{"10000", "OK", data}
c.Data["json"] = resp
}

View File

@ -815,6 +815,7 @@ func (c *TestPaperApiController) SelfMarkPoint() {
if math.Abs(float64(sum-test.Examiner_first_score))>float64(standardError) {
var newUnderTest models.UnderCorrectedPaper
newUnderTest.User_id="10000"
newUnderTest.Self_score_id=userId
newUnderTest.Test_id=testId
newUnderTest.Question_id=test.Question_id
newUnderTest.Test_question_type=7
@ -895,6 +896,7 @@ func (c *TestPaperApiController) SelfMarkPoint() {
var newUnderTest models.UnderCorrectedPaper
newUnderTest.User_id="10000"
newUnderTest.Test_id=testId
newUnderTest.Self_score_id=userId
newUnderTest.Question_id=test.Question_id
newUnderTest.Test_question_type=7
newUnderTest.Save()
@ -976,6 +978,7 @@ func (c *TestPaperApiController) SelfMarkPoint() {
newUnderTest.User_id="10000"
newUnderTest.Test_id=testId
newUnderTest.Question_id=test.Question_id
newUnderTest.Self_score_id=userId
newUnderTest.Test_question_type=7
newUnderTest.Save()
}

View File

@ -417,11 +417,19 @@ func (c *SupervisorApiController) SelfScore() {
//求教师名和转化输出
for i:=0 ;i<len(selfScoreRecord);i++ {
testId :=selfScoreRecord[i].Test_id
var testScoreRecord models.ScoreRecord
models.GetTestScoreRecordByTestIdAndUserId(&testScoreRecord,testId,examinerId)
var test models.TestPaper
test.GetTestPaperByTestId(testId)
if test.Examiner_first_id== examinerId{
selfScoreRecordVOList[i].Score =test.Examiner_first_score
selfScoreRecordVOList[i].SelfScore=test.Examiner_first_self_score
}else if test.Examiner_second_id==examinerId {
selfScoreRecordVOList[i].Score=test.Examiner_second_score
selfScoreRecordVOList[i].SelfScore=test.Examiner_second_self_score
}else if test.Examiner_third_id==examinerId {
selfScoreRecordVOList[i].Score =test.Examiner_third_score
selfScoreRecordVOList[i].SelfScore=test.Examiner_third_self_score
}
selfScoreRecordVOList[i].TestId=testId
selfScoreRecordVOList[i].Score=testScoreRecord.Score
selfScoreRecordVOList[i].SelfScore=selfScoreRecord[i].Score
}
@ -1455,7 +1463,26 @@ func (c *SupervisorApiController) SelfMarkList() {
for i:=0 ;i<len(selfMarkPaper);i++ {
//存testId
var testId = selfMarkPaper[i].Test_id
testId := selfMarkPaper[i].Test_id
selfScoreId := selfMarkPaper[i].Self_score_id
var test models.TestPaper
test.GetTestPaperByTestId(testId)
if test.Examiner_first_id==selfScoreId {
selfMarkVOList[i].Score =test.Examiner_first_score
selfMarkVOList[i].SelfScore=test.Examiner_first_self_score
}else if test.Examiner_second_id==selfScoreId {
selfMarkVOList[i].Score=test.Examiner_second_score
selfMarkVOList[i].SelfScore=test.Examiner_second_self_score
}else if test.Examiner_third_id==selfScoreId {
selfMarkVOList[i].Score =test.Examiner_third_score
selfMarkVOList[i].SelfScore=test.Examiner_third_self_score
}
selfMarkVOList[i].Userid=selfScoreId
var user models.User
user.GetUser(selfScoreId)
selfMarkVOList[i].Name=user.User_name
selfMarkVOList[i].TestId=testId
}

View File

@ -1 +1 @@
{"C:\\Users\\yang\\Desktop\\阅卷系统\\controllers":1632576621003759500}
{"C:\\Users\\chen\\go\\src\\open-ct\\controllers":1632585323161191500}

View File

@ -9,7 +9,7 @@ import (
type TestPaper struct {
Test_id int64 `json:"test_id" xorm:"pk autoincr"`
Question_id int64 `json:"question_id"`
Candidate string `json:"candidate"`
Candidate string `json:"candidate"`
Question_status int64 `json:"question_status"`
Examiner_first_id string `json:"examiner_first_id" xorm:"default('-1')"`
Examiner_first_score int64 `json:"examiner_first_score" xorm:"default(-1)"`
@ -36,6 +36,13 @@ func (t *TestPaper) GetTestPaperByQuestionIdAndQuestionStatus(question_id int64,
}
return err
}
func (t *TestPaper) GetTestPaperByTestId(testId int64) error {
has, err := x.Where("test_id = ?", testId).Get(t)
if !has || err != nil {
log.Println("could not GetTestPaperByTestId")
}
return err
}
func GetTestPaperListByQuestionIdAndQuestionStatus(question_id int64, question_statue int64, tl *[]TestPaper) error {
err := x.Where("question_id = ? and question_status = ?", question_id, question_statue).Find(tl)
@ -72,7 +79,15 @@ func (t *TestPaper) Insert() error {
}
func FindTestPaperByQuestionId(question_id int64, t *[]TestPaper) error {
err := x.Where("question_id = ? and correcting_status = ?", question_id, 0).Find(t)
err := x.Where("question_id = ?", question_id).Find(t)
if err != nil {
log.Println("could not FindTestPaperByQuestionId ")
log.Println(err)
}
return err
}
func FindTestPapersByTestId(testId, t *[]TestPaper) error {
err := x.Where("question_id = ?", testId).Find(t)
if err != nil {
log.Println("could not FindTestPaperByQuestionId ")
log.Println(err)
@ -128,3 +143,10 @@ func CountThirdScoreNumberByQuestionId(questionId int64)(count int64,err error)
}
return count,err1
}
func DeleteAllTest(questionId int64) error {
_, err := x.Delete(&TestPaper{Question_id:questionId})
if err != nil {
log.Println("delete fail")
}
return err
}

View File

@ -75,3 +75,19 @@ func GetTestInfoPicListByTestId(id int64, as *[]string) error {
}
return err
}
func FindTestPaperInfoByQuestionDetailId(questionDetailId int64, t *[]TestPaperInfo) error {
err := x.Where("question_detail_id = ?", questionDetailId).Find(t)
if err != nil {
log.Println("could not FindTestPaperInfoByQuestionId ")
log.Println(err)
}
return err
}
func (u *TestPaperInfo) Delete() error {
_, err := x.Where(builder.Eq{"test_id": u.Test_id}).Delete(u)
if err != nil {
log.Println("delete fail")
}
return err
}

View File

@ -14,6 +14,7 @@ type UnderCorrectedPaper struct {
Test_question_type int64 `json:"test_question_type"`
Problem_type int64 `json:"problem_type" xorm:"default(-1)"`
Problem_message string `json:"test_message"`
Self_score_id string `json:"self_score_id"`
}
func (u *UnderCorrectedPaper) GetUnderCorrectedPaper(userId string, testId int64) error {
@ -96,6 +97,14 @@ func CountProblemUnFinishNumberByQuestionId(questionId int64 )(count int64,err e
}
return count,err1
}
func CountUnScoreTestNumberByQuestionId(questionId int64 )(count int64,err error) {
underCorrectedPaper:=new (UnderCorrectedPaper)
count, err1 := x.Where("question_id = ?", questionId).Count(underCorrectedPaper)
if err!=nil {
log.Println("CountUnScoreTestNumberByQuestionId err ")
}
return count,err1
}
func GetUnderCorrectedPaperByUserIdAndTestId(underCorrectedPaper * UnderCorrectedPaper ,userId string,testId int64) error {

View File

@ -27,6 +27,10 @@ type DistributionInfo struct {
AdminId string `json:"adminId"`
QuestionId int64 `json:"questionId"`
}
type DeleteTest struct {
AdminId string `json:"adminId"`
QuestionId int64 `json:"questionId"`
}
type Distribution struct {
AdminId string `json:"adminId"`
@ -35,16 +39,7 @@ type Distribution struct {
UserNumber int `json:"userNumber"`
}
//type ReadExcel struct {
// AdminId string `json:"adminId"`
//// FilePath string `json:"filePath"`
// Excel []byte `json:"excel"`
//}
//
//type ReadExcelBytes struct {
// AdminId string ` form:"adminId" binding:"required"`
// Excel []byte `form:"excel" binding:"required"`
//}
type ReadFile struct {
PicName string `json:"picName"`
}

View File

@ -81,6 +81,10 @@ type ArbitramentUnmarkListVO struct {
}
type SelfMarkListVO struct {
TestId int64
Score int64
SelfScore int64
Userid string
Name string
}
type ScoreProgressVO struct {