Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
EduSpider
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
viitto
EduSpider
Commits
c8e61086
Commit
c8e61086
authored
May 31, 2022
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
ac5e2d2d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
145 additions
and
137 deletions
+145
-137
StuHomeWorkRepository.cs
EduSpider.Repository/StuHomeWorkRepository.cs
+144
-136
CourseService.cs
EduSpider.Services/CourseService.cs
+1
-1
No files found.
EduSpider.Repository/StuHomeWorkRepository.cs
View file @
c8e61086
...
...
@@ -105,7 +105,7 @@ WHERE 1=1
Score_Value
=
item
.
Score_value
,
HomeWorkStatus
=
item
.
status
,
ThName
=
item
.
th_name
,
Stu_HomeWork_Id
=
item
.
stu_homework_id
,
Stu_HomeWork_Id
=
item
.
stu_homework_id
,
});
RowNum
++;
}
...
...
@@ -113,7 +113,7 @@ WHERE 1=1
//课程配置评论列表
var
courseCommentModel
=
courseCommentRepository
.
GetCourseCommentListRepository
(
new
CourseQuery
()
{
QCourseIds
=
query
.
CourseId
.
ToString
()
}).
FirstOrDefault
();
//学员评论列表
var
commentList
=
stuCommentRepository
.
GetStuCommentListRepository
(
new
CourseQuery
()
{
CourseId
=
query
.
CourseId
,
StuIds
=
query
.
StuIds
});
var
commentList
=
stuCommentRepository
.
GetStuCommentListRepository
(
new
CourseQuery
()
{
CourseId
=
query
.
CourseId
,
StuIds
=
query
.
StuIds
});
ExamWorkResult
firstComment
=
null
;
ExamWorkResult
secondComment
=
null
;
...
...
@@ -121,176 +121,132 @@ WHERE 1=1
string
info
;
if
(
homeWorkList
!=
null
&&
homeWorkList
.
Count
>
0
)
{
//第一次评价
if
(
homeWorkList
.
Count
>=
5
)
{
var
firstList
=
homeWorkList
.
Where
(
qitem
=>
qitem
.
RowNum
<=
5
).
ToList
();
var
firstScore
=
firstList
.
Average
(
qitem
=>
qitem
.
Score_p
)
*
100
;
info
=
""
;
var
commentModel
=
commentRepository
.
GetComment
(
firstScore
);
if
(
courseCommentModel
!=
null
&&
courseCommentModel
.
CommentDetails
!=
null
&&
courseCommentModel
.
CommentDetails
.
Count
()
>
0
)
var
firstFlag
=
firstList
.
Where
(
qitem
=>
qitem
.
HomeWorkStatus
==
0
).
Count
()
>
0
;
//第一阶段有未提交的作业就不生成系统评价
if
(!
firstFlag
)
{
var
tempModel
=
courseCommentModel
.
CommentDetails
.
Where
(
qitem
=>
qitem
.
StartNum
<=
firstScore
&&
firstScore
<
qitem
.
EndNum
)?.
FirstOrDefault
();
if
(
tempModel
!=
null
)
{
info
=
tempModel
?.
Info
??
""
;
}
else
{
info
=
commentModel
?.
Info
??
""
;
}
}
else
{
info
=
commentModel
?.
Info
??
""
;
}
if
(
commentList
?.
Where
(
qitem
=>
qitem
.
CourseId
==
qitem
.
CourseId
&&
qitem
.
HomeWorkId
==
firstList
.
LastOrDefault
().
Stu_HomeWork_Id
&&
qitem
.
CreateType
==
1
).
Count
()
>
0
)
{
var
tempModel
=
commentList
.
Where
(
qitem
=>
qitem
.
CourseId
==
qitem
.
CourseId
&&
qitem
.
HomeWorkId
==
firstList
.
LastOrDefault
().
Stu_HomeWork_Id
&&
qitem
.
CreateType
==
1
).
FirstOrDefault
();
var
firstScore
=
firstList
.
Average
(
qitem
=>
qitem
.
Score_p
)
*
100
;
string
title
=
firstList
.
LastOrDefault
().
ThName
+
"老师的评语"
;
info
=
GetCommentInfo
(
courseCommentModel
,
firstScore
);
var
First_Stu_HomeWork_Id
=
firstList
.
LastOrDefault
().
Stu_HomeWork_Id
;
var
tempModel
=
GetSystemCreateComment
(
commentList
,
query
.
CourseId
,
First_Stu_HomeWork_Id
);
firstComment
=
new
ExamWorkResult
()
{
CreateTime
=
tempModel
.
CreateTime
,
ResultType
=
3
,
Title
=
firstList
.
LastOrDefault
().
ThName
+
"老师的评语"
,
Comment
=
tempModel
?.
Info
};
}
else
{
firstComment
=
new
ExamWorkResult
()
{
CreateTime
=
firstList
.
LastOrDefault
().
CreateTime
.
AddMinutes
(
1
),
ResultType
=
3
,
Title
=
firstList
.
LastOrDefault
().
ThName
+
"老师的评语"
,
Comment
=
info
};
stuCommentRepository
.
SetStuCommentRepository
(
new
RB_Stu_Comment
()
{
Id
=
0
,
HomeWorkId
=
firstList
.
LastOrDefault
().
Stu_HomeWork_Id
,
StuUid
=
Convert
.
ToInt32
(
query
.
StuIds
),
CourseId
=
query
.
CourseId
,
Times
=
1
,
Info
=
info
,
CreateType
=
1
,
CreateByName
=
firstList
.
LastOrDefault
().
ThName
,
CreateTime
=
firstList
.
LastOrDefault
().
CreateTime
.
AddMinutes
(
1
),
});
}
}
if
(
homeWorkList
.
Count
>=
9
)
{
var
secondList
=
homeWorkList
.
Where
(
qitem
=>
qitem
.
RowNum
>
5
&&
qitem
.
RowNum
<=
9
).
ToList
();
var
secondScore
=
secondList
.
Average
(
qitem
=>
qitem
.
Score_p
)
*
100
;
info
=
""
;
var
commentModel
=
commentRepository
.
GetComment
(
secondScore
);
if
(
courseCommentModel
!=
null
&&
courseCommentModel
.
CommentDetails
!=
null
&&
courseCommentModel
.
CommentDetails
.
Count
()
>
0
)
{
var
tempModel
=
courseCommentModel
.
CommentDetails
.
Where
(
qitem
=>
qitem
.
StartNum
<=
secondScore
&&
secondScore
<
qitem
.
EndNum
)?.
FirstOrDefault
();
if
(
tempModel
!=
null
)
{
info
=
tempModel
?.
Info
??
""
;
firstComment
.
CreateTime
=
tempModel
.
CreateTime
;
firstComment
.
Comment
=
tempModel
.
Info
;
}
else
{
info
=
commentModel
?.
Info
??
""
;
var
firstNum
=
CreateRandomNum
();
firstComment
.
CreateTime
=
firstList
.
LastOrDefault
().
CreateTime
.
AddMinutes
(
firstNum
);
firstComment
.
Comment
=
info
;
//新增系统生成评价
stuCommentRepository
.
SetStuCommentRepository
(
new
RB_Stu_Comment
()
{
Id
=
0
,
HomeWorkId
=
First_Stu_HomeWork_Id
,
StuUid
=
Convert
.
ToInt32
(
query
.
StuIds
),
CourseId
=
query
.
CourseId
,
Times
=
1
,
Info
=
info
,
CreateType
=
1
,
CreateByName
=
firstList
.
LastOrDefault
().
ThName
,
CreateTime
=
firstComment
.
CreateTime
,
});
}
}
else
{
info
=
commentModel
?.
Info
??
""
;
}
if
(
commentList
?.
Where
(
qitem
=>
qitem
.
CourseId
==
qitem
.
CourseId
&&
qitem
.
HomeWorkId
==
secondList
.
LastOrDefault
().
Stu_HomeWork_Id
&&
qitem
.
CreateType
==
1
).
Count
()
>
0
)
{
var
tempModel
=
commentList
.
Where
(
qitem
=>
qitem
.
CourseId
==
qitem
.
CourseId
&&
qitem
.
HomeWorkId
==
secondList
.
LastOrDefault
().
Stu_HomeWork_Id
&&
qitem
.
CreateType
==
1
).
FirstOrDefault
();
secondComment
=
new
ExamWorkResult
()
{
CreateTime
=
tempModel
.
CreateTime
,
ResultType
=
3
,
Title
=
secondList
.
LastOrDefault
().
ThName
+
"老师的评语"
,
Comment
=
tempModel
?.
Info
};
}
else
}
//第二次评价
if
(
homeWorkList
.
Count
>=
9
)
{
var
secondList
=
homeWorkList
.
Where
(
qitem
=>
qitem
.
RowNum
>
5
&&
qitem
.
RowNum
<=
9
).
ToList
();
var
secondFlag
=
secondList
.
Where
(
qitem
=>
qitem
.
HomeWorkStatus
==
0
).
Count
()
>
0
;
if
(!
secondFlag
)
{
var
secondScore
=
secondList
.
Average
(
qitem
=>
qitem
.
Score_p
)
*
100
;
info
=
GetCommentInfo
(
courseCommentModel
,
secondScore
);
var
Second_Stu_HomeWork_Id
=
secondList
.
LastOrDefault
().
Stu_HomeWork_Id
;
var
secondModel
=
GetSystemCreateComment
(
commentList
,
query
.
CourseId
,
Second_Stu_HomeWork_Id
);
secondComment
=
new
ExamWorkResult
()
{
CreateTime
=
secondList
.
LastOrDefault
().
CreateTime
.
AddMinutes
(
1
),
ResultType
=
3
,
Title
=
secondList
.
LastOrDefault
().
ThName
+
"老师的评语"
,
Comment
=
info
,
};
stuCommentRepository
.
SetStuCommentRepository
(
new
RB_Stu_Comment
(
)
if
(
secondModel
!=
null
)
{
Id
=
0
,
HomeWorkId
=
secondList
.
LastOrDefault
().
Stu_HomeWork_Id
,
StuUid
=
Convert
.
ToInt32
(
query
.
StuIds
),
CourseId
=
query
.
CourseId
,
Times
=
2
,
Info
=
info
,
CreateType
=
1
,
CreateByName
=
secondList
.
LastOrDefault
().
ThName
,
CreateTime
=
secondList
.
LastOrDefault
().
CreateTime
.
AddMinutes
(
1
),
});
}
}
if
(
homeWorkList
.
Count
>=
13
)
{
var
thirdList
=
homeWorkList
.
Where
(
qitem
=>
qitem
.
RowNum
>
9
&&
qitem
.
RowNum
<=
13
).
ToList
();
var
thirdScore
=
thirdList
.
Average
(
qitem
=>
qitem
.
Score_p
)
*
100
;
info
=
""
;
var
commentModel
=
commentRepository
.
GetComment
(
thirdScore
);
if
(
courseCommentModel
!=
null
&&
courseCommentModel
.
CommentDetails
!=
null
&&
courseCommentModel
.
CommentDetails
.
Count
()
>
0
)
{
var
tempModel
=
courseCommentModel
.
CommentDetails
.
Where
(
qitem
=>
qitem
.
StartNum
<=
thirdScore
&&
thirdScore
<
qitem
.
EndNum
)?.
FirstOrDefault
();
if
(
tempModel
!=
null
)
{
info
=
tempModel
?.
Info
??
""
;
secondComment
.
CreateTime
=
secondModel
.
CreateTime
;
secondComment
.
Comment
=
secondModel
.
Info
;
}
else
{
info
=
commentModel
?.
Info
??
""
;
var
secondNum
=
CreateRandomNum
();
secondComment
.
CreateTime
=
secondList
.
LastOrDefault
().
CreateTime
.
AddMinutes
(
secondNum
);
secondComment
.
Comment
=
info
;
stuCommentRepository
.
SetStuCommentRepository
(
new
RB_Stu_Comment
()
{
Id
=
0
,
HomeWorkId
=
Second_Stu_HomeWork_Id
,
StuUid
=
Convert
.
ToInt32
(
query
.
StuIds
),
CourseId
=
query
.
CourseId
,
Times
=
2
,
Info
=
info
,
CreateType
=
1
,
CreateByName
=
secondList
.
LastOrDefault
().
ThName
,
CreateTime
=
secondComment
.
CreateTime
,
});
}
}
else
{
info
=
commentModel
?.
Info
??
""
;
}
if
(
commentList
?.
Where
(
qitem
=>
qitem
.
CourseId
==
qitem
.
CourseId
&&
qitem
.
HomeWorkId
==
thirdList
.
LastOrDefault
().
Stu_HomeWork_Id
&&
qitem
.
CreateType
==
1
).
Count
()
>
0
)
}
//第三次评价
if
(
homeWorkList
.
Count
>=
13
)
{
var
thirdList
=
homeWorkList
.
Where
(
qitem
=>
qitem
.
RowNum
>
9
&&
qitem
.
RowNum
<=
13
).
ToList
();
var
thirdFlag
=
thirdList
.
Where
(
qitem
=>
qitem
.
HomeWorkStatus
==
0
).
Count
()
>
0
;
if
(!
thirdFlag
)
{
var
tempModel
=
commentList
.
Where
(
qitem
=>
qitem
.
CourseId
==
qitem
.
CourseId
&&
qitem
.
HomeWorkId
==
thirdList
.
LastOrDefault
().
Stu_HomeWork_Id
&&
qitem
.
CreateType
==
1
).
FirstOrDefault
();
var
thirdScore
=
thirdList
.
Average
(
qitem
=>
qitem
.
Score_p
)
*
100
;
info
=
GetCommentInfo
(
courseCommentModel
,
thirdScore
);
var
Third_Stu_HomeWork_Id
=
thirdList
.
LastOrDefault
().
Stu_HomeWork_Id
;
var
thirdModel
=
GetSystemCreateComment
(
commentList
,
query
.
CourseId
,
Third_Stu_HomeWork_Id
);
thirdComment
=
new
ExamWorkResult
()
{
CreateTime
=
tempModel
.
CreateTime
,
ResultType
=
3
,
Title
=
thirdList
.
LastOrDefault
().
ThName
+
"老师的评语"
,
Comment
=
tempModel
?.
Info
};
}
else
{
thirdComment
=
new
ExamWorkResult
()
if
(
thirdModel
!=
null
)
{
CreateTime
=
thirdList
.
LastOrDefault
().
CreateTime
.
AddMinutes
(
1
),
ResultType
=
3
,
Title
=
thirdList
.
LastOrDefault
().
ThName
+
"老师的评语"
,
Comment
=
info
,
};
stuCommentRepository
.
SetStuCommentRepository
(
new
RB_Stu_Comment
()
thirdComment
.
CreateTime
=
thirdModel
.
CreateTime
;
thirdComment
.
Comment
=
thirdModel
.
Info
;
}
else
{
Id
=
0
,
HomeWorkId
=
thirdList
.
LastOrDefault
().
Stu_HomeWork_Id
,
StuUid
=
Convert
.
ToInt32
(
query
.
StuIds
),
CourseId
=
query
.
CourseId
,
Times
=
3
,
Info
=
info
,
CreateType
=
1
,
CreateByName
=
thirdList
.
LastOrDefault
().
ThName
,
CreateTime
=
thirdList
.
LastOrDefault
().
CreateTime
.
AddMinutes
(
1
),
});
var
thirdNum
=
CreateRandomNum
();
thirdComment
.
CreateTime
=
thirdList
.
LastOrDefault
().
CreateTime
.
AddMinutes
(
thirdNum
);
thirdComment
.
Comment
=
info
;
stuCommentRepository
.
SetStuCommentRepository
(
new
RB_Stu_Comment
()
{
Id
=
0
,
HomeWorkId
=
Third_Stu_HomeWork_Id
,
StuUid
=
Convert
.
ToInt32
(
query
.
StuIds
),
CourseId
=
query
.
CourseId
,
Times
=
3
,
Info
=
info
,
CreateType
=
1
,
CreateByName
=
thirdList
.
LastOrDefault
().
ThName
,
CreateTime
=
thirdComment
.
CreateTime
,
});
}
}
}
}
...
...
@@ -329,5 +285,57 @@ WHERE 1=1
}
return
list
;
}
/// <summary>
/// 生成随机数
/// </summary>
/// <returns></returns>
private
int
CreateRandomNum
()
{
Random
rnd
=
new
Random
();
return
rnd
.
Next
(
5
,
20
);
}
/// <summary>
/// 获取系统生成的评论
/// </summary>
/// <param name="commentList"></param>
/// <param name="CourseId"></param>
/// <param name="Stu_HomeWork_Id"></param>
/// <returns></returns>
private
RB_Stu_Comment
GetSystemCreateComment
(
List
<
RB_Stu_Comment
>
commentList
,
int
CourseId
,
int
Stu_HomeWork_Id
)
{
var
tempModel
=
commentList
.
Where
(
qitem
=>
qitem
.
CourseId
==
qitem
.
CourseId
&&
qitem
.
HomeWorkId
==
Stu_HomeWork_Id
&&
qitem
.
CreateType
==
1
).
FirstOrDefault
();
return
tempModel
;
}
/// <summary>
/// 获取课程评论或自定义评论
/// </summary>
/// <param name="courseCommentModel">课程评价配置</param>
/// <param name="Score">平均分数</param>
/// <returns></returns>
private
string
GetCommentInfo
(
RB_Course_Comment_Extend
courseCommentModel
,
decimal
Score
)
{
string
info
=
""
;
var
commentModel
=
commentRepository
.
GetComment
(
Score
);
if
(
courseCommentModel
!=
null
&&
courseCommentModel
.
CommentDetails
!=
null
&&
courseCommentModel
.
CommentDetails
.
Count
()
>
0
)
{
var
tempModel
=
courseCommentModel
.
CommentDetails
.
Where
(
qitem
=>
qitem
.
StartNum
<=
Score
&&
Score
<
qitem
.
EndNum
)?.
FirstOrDefault
();
if
(
tempModel
!=
null
)
{
info
=
tempModel
?.
Info
??
""
;
}
else
{
info
=
commentModel
?.
Info
??
""
;
}
}
else
{
info
=
commentModel
?.
Info
??
""
;
}
return
info
;
}
}
}
EduSpider.Services/CourseService.cs
View file @
c8e61086
...
...
@@ -138,7 +138,7 @@ namespace EduSpider.Services
if
(
dataList
!=
null
&&
dataList
.
Count
>
0
)
{
dataList
=
dataList
.
OrderBy
(
qitem
=>
qitem
.
CreateTime
).
ToList
();
dataList
=
dataList
.
OrderBy
Descending
(
qitem
=>
qitem
.
CreateTime
).
ToList
();
var
firstModel
=
dataList
.
FirstOrDefault
();
foreach
(
var
item
in
dataList
)
{
...
...
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