Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Education
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄奎
Education
Commits
4e220fb6
Commit
4e220fb6
authored
Mar 08, 2022
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
f3a5ef11
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
17 deletions
+69
-17
CourseExamModule.cs
Edu.Module.Exam/CourseExamModule.cs
+39
-16
RB_Student_PracticeRepository.cs
Edu.Repository/Exam/RB_Student_PracticeRepository.cs
+4
-0
RB_QuestionRepository.cs
Edu.Repository/Question/RB_QuestionRepository.cs
+1
-1
ExamController.cs
Edu.WebApi/Controllers/Exam/ExamController.cs
+25
-0
No files found.
Edu.Module.Exam/CourseExamModule.cs
View file @
4e220fb6
...
@@ -700,7 +700,7 @@ namespace Edu.Module.Exam
...
@@ -700,7 +700,7 @@ namespace Edu.Module.Exam
readingFinishCount
=
finishList
?.
Where
(
qitem
=>
qitem
.
Category
==
Common
.
Enum
.
Course
.
QuestionCategoryEnum
.
ReadingChoose
)?.
Count
()
??
0
;
readingFinishCount
=
finishList
?.
Where
(
qitem
=>
qitem
.
Category
==
Common
.
Enum
.
Course
.
QuestionCategoryEnum
.
ReadingChoose
)?.
Count
()
??
0
;
listeningFinishCount
=
finishList
?.
Where
(
qitem
=>
qitem
.
Category
==
Common
.
Enum
.
Course
.
QuestionCategoryEnum
.
Listening
)?.
Count
()
??
0
;
listeningFinishCount
=
finishList
?.
Where
(
qitem
=>
qitem
.
Category
==
Common
.
Enum
.
Course
.
QuestionCategoryEnum
.
Listening
)?.
Count
()
??
0
;
grammarFinishCount
=
finishList
?.
Where
(
qitem
=>
qitem
.
Category
==
Common
.
Enum
.
Course
.
QuestionCategoryEnum
.
ChooseGrammarUse
)?.
Count
()
??
0
;
grammarFinishCount
=
finishList
?.
Where
(
qitem
=>
qitem
.
Category
==
Common
.
Enum
.
Course
.
QuestionCategoryEnum
.
ChooseGrammarUse
)?.
Count
()
??
0
;
words
Total
Count
=
finishList
?.
Where
(
qitem
=>
words
Finish
Count
=
finishList
?.
Where
(
qitem
=>
qitem
.
Category
==
Common
.
Enum
.
Course
.
QuestionCategoryEnum
.
ChooseWord
qitem
.
Category
==
Common
.
Enum
.
Course
.
QuestionCategoryEnum
.
ChooseWord
||
qitem
.
Category
==
Common
.
Enum
.
Course
.
QuestionCategoryEnum
.
ChooseMean
||
qitem
.
Category
==
Common
.
Enum
.
Course
.
QuestionCategoryEnum
.
ChooseMean
||
qitem
.
Category
==
Common
.
Enum
.
Course
.
QuestionCategoryEnum
.
ChooseWordUse
||
qitem
.
Category
==
Common
.
Enum
.
Course
.
QuestionCategoryEnum
.
ChooseWordUse
...
@@ -749,7 +749,6 @@ namespace Edu.Module.Exam
...
@@ -749,7 +749,6 @@ namespace Edu.Module.Exam
foreach
(
var
item
in
dataList
)
foreach
(
var
item
in
dataList
)
{
{
var
QuestionContentObj
=
analysisQuestion
.
ParsingQuestion
(
item
.
QuestionTypeKey
,
item
.
QuestionContent
);
var
QuestionContentObj
=
analysisQuestion
.
ParsingQuestion
(
item
.
QuestionTypeKey
,
item
.
QuestionContent
);
List
<
object
>
answerList
=
new
List
<
object
>();
List
<
object
>
quesAnswerList
=
new
List
<
object
>();
List
<
object
>
quesAnswerList
=
new
List
<
object
>();
//填空题、分录题、资料题
//填空题、分录题、资料题
if
(
item
.
QuestionTypeKey
==
"fill-in"
||
item
.
QuestionTypeKey
==
"entry-problem"
||
item
.
QuestionTypeKey
==
"data-question"
)
if
(
item
.
QuestionTypeKey
==
"fill-in"
||
item
.
QuestionTypeKey
==
"entry-problem"
||
item
.
QuestionTypeKey
==
"data-question"
)
...
@@ -759,7 +758,7 @@ namespace Edu.Module.Exam
...
@@ -759,7 +758,7 @@ namespace Edu.Module.Exam
{
{
foreach
(
var
tItem
in
tempList
)
foreach
(
var
tItem
in
tempList
)
{
{
a
nswerList
.
Add
(
tItem
);
quesA
nswerList
.
Add
(
tItem
);
}
}
}
}
}
}
...
@@ -768,18 +767,25 @@ namespace Edu.Module.Exam
...
@@ -768,18 +767,25 @@ namespace Edu.Module.Exam
{
{
if
(!
string
.
IsNullOrEmpty
(
item
.
Answer
.
ToString
()))
if
(!
string
.
IsNullOrEmpty
(
item
.
Answer
.
ToString
()))
{
{
var
qAnsList
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
List
<
SubAnswerItem
>>(
item
.
Answer
.
ToString
());
try
if
(
qAnsList
!=
null
&&
qAnsList
.
Count
()
>
0
)
{
{
foreach
(
var
tItem
in
qAnsList
)
var
qAnsList
=
Common
.
Plugin
.
JsonHelper
.
DeserializeObject
<
List
<
SubAnswerItem
>>(
item
.
Answer
.
ToString
());
if
(
qAnsList
!=
null
&&
qAnsList
.
Count
()
>
0
)
{
{
quesAnswerList
.
Add
(
tItem
);
foreach
(
var
tItem
in
qAnsList
)
{
quesAnswerList
.
Add
(
tItem
);
}
}
}
}
}
catch
(
Exception
ex
)
{
Common
.
Plugin
.
LogHelper
.
Write
(
ex
,
"GetAppQuestionCategoryListModule_Cloze:"
+
Common
.
Plugin
.
JsonHelper
.
Serialize
(
item
));
}
}
}
}
}
else
if
(
item
.
QuestionTypeKey
==
"reading-comprehensio"
||
item
.
QuestionTypeKey
==
"listening"
)
else
{
{
if
(!
string
.
IsNullOrEmpty
(
item
.
Answer
.
ToString
()))
if
(!
string
.
IsNullOrEmpty
(
item
.
Answer
.
ToString
()))
{
{
...
@@ -800,18 +806,20 @@ namespace Edu.Module.Exam
...
@@ -800,18 +806,20 @@ namespace Edu.Module.Exam
}
}
}
}
}
}
var
obj
=
new
var
obj
=
new
{
{
item
.
QuestionId
,
item
.
QuestionId
,
item
.
QuestionTypeId
,
item
.
QuestionTypeId
,
item
.
QuestionTypeKey
,
item
.
QuestionTypeKey
,
item
.
Category
,
LevelType
=
item
.
BankType
,
item
.
Title
,
item
.
Title
,
item
.
DifficultyType
,
item
.
DifficultyType
,
item
.
DifficultyTypeStr
,
item
.
DifficultyTypeStr
,
item
.
AnswerParse
,
item
.
AnswerParse
,
QuestionContentObj
,
QuestionContentObj
,
QuestionAnswerList
=
quesAnswerList
,
QuestionAnswerList
=
quesAnswerList
,
AnswerList
=
answerList
,
};
};
list
.
Add
(
obj
);
list
.
Add
(
obj
);
}
}
...
@@ -845,11 +853,12 @@ namespace Edu.Module.Exam
...
@@ -845,11 +853,12 @@ namespace Edu.Module.Exam
}
}
foreach
(
var
item
in
bankList
)
foreach
(
var
item
in
bankList
)
{
{
var
tempList
=
stuExamList
?.
Where
(
qitem
=>
qitem
.
BankId
==
item
.
BankId
)?.
ToList
();
var
tempList
=
stuExamList
?.
Where
(
qitem
=>
qitem
.
BankId
==
item
.
BankId
)?.
OrderByDescending
(
qitem
=>
qitem
.
Score
)?.
ToList
();
string
LeastTime
=
""
;
string
LeastTime
=
""
;
//最短时间
decimal
HighestScore
=
0
;
decimal
HighestScore
=
0
;
//最高分
string
MyUseTime
=
""
;
string
MyUseTime
=
""
;
//用时
decimal
MyScore
=
0
;
decimal
MyScore
=
0
;
//得分
int
MyRank
=
0
;
//排名
if
(
tempList
!=
null
)
if
(
tempList
!=
null
)
{
{
var
least
=
tempList
?.
OrderBy
(
qitem
=>
qitem
.
ExamMinutes
)?.
FirstOrDefault
();
var
least
=
tempList
?.
OrderBy
(
qitem
=>
qitem
.
ExamMinutes
)?.
FirstOrDefault
();
...
@@ -860,6 +869,7 @@ namespace Edu.Module.Exam
...
@@ -860,6 +869,7 @@ namespace Edu.Module.Exam
{
{
MyUseTime
=
Common
.
ConvertHelper
.
CalcMinutesAndSeconds
(
myLast
.
StartTime
,
myLast
.
EndTime
);
MyUseTime
=
Common
.
ConvertHelper
.
CalcMinutesAndSeconds
(
myLast
.
StartTime
,
myLast
.
EndTime
);
MyScore
=
myLast
.
Score
;
MyScore
=
myLast
.
Score
;
MyRank
=
tempList
?.
FindIndex
(
qitem
=>
qitem
.
StudentId
==
query
.
StudentId
)
??
0
;
}
}
}
}
var
obj
=
new
var
obj
=
new
...
@@ -871,7 +881,7 @@ namespace Edu.Module.Exam
...
@@ -871,7 +881,7 @@ namespace Edu.Module.Exam
HighestScore
,
HighestScore
,
MyUseTime
,
MyUseTime
,
MyScore
,
MyScore
,
MyRank
=
new
Random
().
Next
(
1
,
10
)
,
MyRank
,
};
};
result
.
Add
(
obj
);
result
.
Add
(
obj
);
}
}
...
@@ -984,6 +994,12 @@ namespace Edu.Module.Exam
...
@@ -984,6 +994,12 @@ namespace Edu.Module.Exam
public
bool
SetStudentPracticeModule
(
RB_Student_Practice_Extend
model
)
public
bool
SetStudentPracticeModule
(
RB_Student_Practice_Extend
model
)
{
{
bool
flag
=
false
;
bool
flag
=
false
;
var
oldModel
=
student_PracticeRepository
.
GetStudentPracticeListRepository
(
new
RB_Student_Practice_Extend
()
{
StudentId
=
model
.
StudentId
,
QuestionId
=
model
.
QuestionId
})?.
FirstOrDefault
();
model
.
Id
=
oldModel
?.
Id
??
0
;
if
(
model
.
Id
>
0
)
if
(
model
.
Id
>
0
)
{
{
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
Dictionary
<
string
,
object
>
fileds
=
new
Dictionary
<
string
,
object
>()
...
@@ -1024,7 +1040,14 @@ namespace Edu.Module.Exam
...
@@ -1024,7 +1040,14 @@ namespace Edu.Module.Exam
model
.
Id
=
newId
;
model
.
Id
=
newId
;
flag
=
newId
>
0
;
flag
=
newId
>
0
;
}
}
if
(
flag
&&
model
.
ExamDetailsList
!=
null
&&
model
.
ExamDetailsList
.
Count
>
0
)
{
foreach
(
var
item
in
model
.
ExamDetailsList
)
{
item
.
ExamId
=
model
.
Id
;
student_ExamDetailsRepository
.
Insert
(
item
);
}
}
return
flag
;
return
flag
;
}
}
#
endregion
#
endregion
...
...
Edu.Repository/Exam/RB_Student_PracticeRepository.cs
View file @
4e220fb6
...
@@ -39,6 +39,10 @@ WHERE 1=1
...
@@ -39,6 +39,10 @@ WHERE 1=1
{
{
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Student_Practice_Extend
.
LevelType
),
(
int
)
query
.
LevelType
);
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Student_Practice_Extend
.
LevelType
),
(
int
)
query
.
LevelType
);
}
}
if
(
query
.
QuestionId
>
0
)
{
builder
.
AppendFormat
(
" AND A.{0}={1} "
,
nameof
(
RB_Student_Practice_Extend
.
QuestionId
),
query
.
QuestionId
);
}
}
}
return
Get
<
RB_Student_Practice_Extend
>(
builder
.
ToString
()).
ToList
();
return
Get
<
RB_Student_Practice_Extend
>(
builder
.
ToString
()).
ToList
();
}
}
...
...
Edu.Repository/Question/RB_QuestionRepository.cs
View file @
4e220fb6
...
@@ -147,7 +147,7 @@ WHERE 1=1 AND B.Status=0 AND A.Status=0
...
@@ -147,7 +147,7 @@ WHERE 1=1 AND B.Status=0 AND A.Status=0
var
parameters
=
new
DynamicParameters
();
var
parameters
=
new
DynamicParameters
();
StringBuilder
builder
=
new
StringBuilder
();
StringBuilder
builder
=
new
StringBuilder
();
builder
.
AppendFormat
(
@"
builder
.
AppendFormat
(
@"
SELECT A.*,IFNULL(B.`Name` ,'') AS QuestionTypeName
SELECT A.*,IFNULL(B.`Name` ,'') AS QuestionTypeName
,IFNULL(C.BankType,0) AS BankType
FROM RB_Question AS A LEFT JOIN RB_Question_Type B ON A.QuestionTypeId=B.QId
FROM RB_Question AS A LEFT JOIN RB_Question_Type B ON A.QuestionTypeId=B.QId
INNER JOIN rb_question_bank AS C ON A.BankId=C.BankId
INNER JOIN rb_question_bank AS C ON A.BankId=C.BankId
WHERE 1=1
WHERE 1=1
...
...
Edu.WebApi/Controllers/Exam/ExamController.cs
View file @
4e220fb6
...
@@ -1097,6 +1097,7 @@ namespace Edu.WebApi.Controllers.Exam
...
@@ -1097,6 +1097,7 @@ namespace Edu.WebApi.Controllers.Exam
/// </summary>
/// </summary>
/// <returns></returns>
/// <returns></returns>
[
HttpPost
]
[
HttpPost
]
[
AllowRepeat
]
public
ApiResult
SetStudentPractice
()
public
ApiResult
SetStudentPractice
()
{
{
var
model
=
new
RB_Student_Practice_Extend
()
var
model
=
new
RB_Student_Practice_Extend
()
...
@@ -1118,5 +1119,29 @@ namespace Edu.WebApi.Controllers.Exam
...
@@ -1118,5 +1119,29 @@ namespace Edu.WebApi.Controllers.Exam
bool
flag
=
courseExamModule
.
SetStudentPracticeModule
(
model
);
bool
flag
=
courseExamModule
.
SetStudentPracticeModule
(
model
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
}
/// <summary>
/// 新增修改学员考试
/// </summary>
/// <returns></returns>
[
HttpPost
]
[
AllowRepeat
]
public
ApiResult
SetStudentExam
()
{
var
model
=
new
RB_Student_Exam_Extend
()
{
Id
=
base
.
ParmJObj
.
GetInt
(
"Id"
),
BankId
=
base
.
ParmJObj
.
GetInt
(
"BankId"
),
StudentId
=
base
.
ParmJObj
.
GetInt
(
"StudentId"
),
StartTime
=
base
.
ParmJObj
.
GetDateTime
(
"StartTime"
),
EndTime
=
base
.
ParmJObj
.
GetDateTime
(
"EndTime"
),
Score
=
base
.
ParmJObj
.
GetDecimal
(
"Score"
),
Times
=
base
.
ParmJObj
.
GetInt
(
"Times"
),
CreateTime
=
DateTime
.
Now
,
GroupId
=
base
.
ParmJObj
.
GetInt
(
"GroupId"
)
};
bool
flag
=
courseExamModule
.
SetStudentExamModule
(
model
);
return
flag
?
ApiResult
.
Success
()
:
ApiResult
.
Failed
();
}
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment