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
a43b8308
Commit
a43b8308
authored
Jan 12, 2022
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
页面修改
parent
381765f3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
126 additions
and
82 deletions
+126
-82
RB_Course_Words_Extend.cs
Edu.Model/ViewModel/Course/RB_Course_Words_Extend.cs
+5
-0
CourseExamModule.cs
Edu.Module.Exam/CourseExamModule.cs
+117
-82
RB_Course_WordsRepository.cs
Edu.Repository/Course/RB_Course_WordsRepository.cs
+4
-0
No files found.
Edu.Model/ViewModel/Course/RB_Course_Words_Extend.cs
View file @
a43b8308
...
...
@@ -19,5 +19,10 @@ namespace Edu.Model.ViewModel.Course
/// 章节编号
/// </summary>
public
string
QChapterIds
{
get
;
set
;
}
/// <summary>
/// 小于等于当前章节
/// </summary>
public
int
LessThanOrEqualChapterId
{
get
;
set
;
}
}
}
Edu.Module.Exam/CourseExamModule.cs
View file @
a43b8308
...
...
@@ -57,6 +57,11 @@ namespace Edu.Module.Exam
QChapterIds
=
ChapterId
+
","
+
NextChapterId
});
var
totalList
=
course_WordsRepository
.
GetCourseWordsListRepository
(
new
RB_Course_Words_Extend
()
{
CourseId
=
CourseId
,
LessThanOrEqualChapterId
=
ChapterId
,
})?.
OrderBy
(
qitem
=>
Guid
.
NewGuid
())?.
ToList
();
var
reviewList
=
list
?.
Where
(
qitem
=>
qitem
.
ChapterId
==
ChapterId
)?.
OrderBy
(
qitem
=>
Guid
.
NewGuid
())?.
ToList
();
var
prepList
=
list
?.
Where
(
qitem
=>
qitem
.
ChapterId
==
NextChapterId
)?.
OrderBy
(
qitem
=>
Guid
.
NewGuid
())?.
ToList
();
List
<
object
>
reviewGroupList
=
new
List
<
object
>();
...
...
@@ -66,32 +71,34 @@ namespace Edu.Module.Exam
{
for
(
var
i
=
0
;
i
<
reviewList
.
Count
;
i
++)
{
var
titleRandomNum
=
Common
.
ConvertHelper
.
CreateRandomNum
();
var
titleRandomNum
=
Common
.
ConvertHelper
.
CreateRandomNum
();
var
tempWords
=
reviewList
[
i
];
//选择题
if
(
titleRandomNum
%
2
==
0
)
{
var
tempList
=
reviewList
.
Where
(
qitem
=>
qitem
.
Id
!=
tempWords
.
Id
)?.
Take
(
3
)?.
ToList
();
if
(
tempList
!=
null
&&
tempList
.
Count
>
2
)
{
reviewGroupList
.
Add
(
CreateSingleModule
(
tempWords
,
tempList
));
}
else
{
if
(!
string
.
IsNullOrEmpty
(
tempWords
.
ChineseMean
)
||
!
string
.
IsNullOrEmpty
(
tempWords
.
WordWrite
))
{
reviewGroupList
.
Add
(
CreateFillInModule
(
tempWords
));
}
}
}
//填空题
else
{
if
(!
string
.
IsNullOrEmpty
(
tempWords
.
ChineseMean
)
||
!
string
.
IsNullOrEmpty
(
tempWords
.
WordWrite
))
{
reviewGroupList
.
Add
(
CreateFillInModule
(
tempWords
));
}
}
reviewGroupList
.
Add
(
CreateSingleModule
(
tempWords
,
totalList
));
////选择题
//if (titleRandomNum % 2 == 0)
//{
//
// if (tempList != null && tempList.Count > 2)
// {
// reviewGroupList.Add(CreateSingleModule(tempWords, tempList));
// }
// else
// {
// if (!string.IsNullOrEmpty(tempWords.ChineseMean) || !string.IsNullOrEmpty(tempWords.WordWrite))
// {
// reviewGroupList.Add(CreateFillInModule(tempWords));
// }
// }
//}
////填空题
//else
//{
// if (!string.IsNullOrEmpty(tempWords.ChineseMean) || !string.IsNullOrEmpty(tempWords.WordWrite))
// {
// reviewGroupList.Add(CreateFillInModule(tempWords));
// }
//}
}
}
...
...
@@ -141,7 +148,7 @@ namespace Edu.Module.Exam
}
}
var
fillinObj
=
new
var
fillinObj
=
new
{
QuestionTypeName
=
"填空题"
,
QuestionTypeId
=
3
,
...
...
@@ -155,7 +162,7 @@ namespace Edu.Module.Exam
item
.
WordWrite
,
item
.
ChineseMean
,
item
.
FileUrl
,
IsTrue
=
0
,
IsTrue
=
0
,
};
return
fillinObj
;
}
...
...
@@ -164,33 +171,17 @@ namespace Edu.Module.Exam
/// 创建单选题
/// </summary>
/// <returns></returns>
public
object
CreateSingleModule
(
RB_Course_Words_Extend
item
,
List
<
RB_Course_Words_Extend
>
choose
List
)
public
object
CreateSingleModule
(
RB_Course_Words_Extend
item
,
List
<
RB_Course_Words_Extend
>
total
List
)
{
string
title
=
"我是问题"
;
int
randNum
=
Common
.
ConvertHelper
.
CreateRandomNum
();
List
<
optionItem
>
options
=
new
List
<
optionItem
>();
var
tempList
=
totalList
?.
OrderBy
(
qitem
=>
Guid
.
NewGuid
())?.
ToList
();
switch
(
randNum
)
{
//根据单词选择中文意思
case
0
:
title
=
string
.
Format
(
"请选择【{0}】单词的正确中文意思."
,
item
.
WordContent
);
options
.
Add
(
new
optionItem
()
{
Content
=
item
.
ChineseMean
,
IsAnswer
=
true
,
Name
=
""
,
ShowName
=
""
});
foreach
(
var
cItem
in
chooseList
)
{
options
.
Add
(
new
optionItem
()
{
Content
=
cItem
.
ChineseMean
,
IsAnswer
=
false
,
Name
=
""
,
ShowName
=
""
,
});
}
title
=
CreateDefaultQuestion
(
item
,
tempList
,
options
);
break
;
//根据中文意思选择单词
case
1
:
...
...
@@ -202,20 +193,23 @@ namespace Edu.Module.Exam
Name
=
""
,
ShowName
=
""
});
for
each
(
var
cItem
in
chooseList
)
for
(
var
i
=
0
;
i
<
3
;
i
++
)
{
var
cItem
=
tempList
[
i
];
options
.
Add
(
new
optionItem
()
{
Content
=
cItem
.
WordContent
,
Content
=
!
string
.
IsNullOrEmpty
(
cItem
.
WordContent
)
?
cItem
.
WordContent
:
(
totalList
?.
FirstOrDefault
(
qitem
=>
!
string
.
IsNullOrEmpty
(
qitem
.
WordContent
))?.
WordContent
??
""
)
,
IsAnswer
=
false
,
Name
=
""
,
ShowName
=
""
,
});
}
break
;
//根据日语书写选择中文意思
case
2
:
title
=
item
.
WordWrite
;
if
(!
string
.
IsNullOrEmpty
(
item
.
WordWrite
)
&&
!
string
.
IsNullOrEmpty
(
item
.
WordContent
))
{
title
=
string
.
Format
(
"请选择【{0}】所对应的单词."
,
item
.
WordWrite
);
options
.
Add
(
new
optionItem
()
{
...
...
@@ -224,19 +218,27 @@ namespace Edu.Module.Exam
Name
=
""
,
ShowName
=
""
});
foreach
(
var
cItem
in
chooseList
)
for
(
var
i
=
0
;
i
<
3
;
i
++
)
{
var
cItem
=
tempList
[
i
];
options
.
Add
(
new
optionItem
()
{
Content
=
cItem
.
WordContent
,
Content
=
!
string
.
IsNullOrEmpty
(
cItem
.
WordContent
)
?
cItem
.
WordContent
:
(
totalList
?.
FirstOrDefault
(
qitem
=>
!
string
.
IsNullOrEmpty
(
qitem
.
WordContent
))?.
WordContent
??
""
)
,
IsAnswer
=
false
,
Name
=
""
,
ShowName
=
""
,
});
}
}
else
{
title
=
CreateDefaultQuestion
(
item
,
totalList
,
options
);
}
break
;
//根据中文意思选日语书写
case
3
:
if
(!
string
.
IsNullOrEmpty
(
item
.
WordWrite
)&&!
string
.
IsNullOrEmpty
(
item
.
ChineseMean
))
{
title
=
string
.
Format
(
"请选择【{0}】所对应日语书写."
,
item
.
ChineseMean
);
options
.
Add
(
new
optionItem
()
{
...
...
@@ -245,19 +247,28 @@ namespace Edu.Module.Exam
Name
=
""
,
ShowName
=
""
});
foreach
(
var
cItem
in
chooseList
)
for
(
var
i
=
0
;
i
<
3
;
i
++
)
{
var
cItem
=
tempList
[
i
];
options
.
Add
(
new
optionItem
()
{
Content
=
cItem
.
WordWrite
,
Content
=
!
string
.
IsNullOrEmpty
(
cItem
.
WordWrite
)
?
cItem
.
WordWrite
:
(
totalList
?.
FirstOrDefault
(
qitem
=>
!
string
.
IsNullOrEmpty
(
qitem
.
WordWrite
))?.
WordWrite
??
""
)
,
IsAnswer
=
false
,
Name
=
""
,
ShowName
=
""
,
});
}
}
else
{
title
=
CreateDefaultQuestion
(
item
,
totalList
,
options
);
}
break
;
}
options
=
options
?.
OrderBy
(
qitem
=>
Guid
.
NewGuid
())?.
ToList
();
string
Answer
=
""
;
for
(
var
j
=
1
;
j
<=
options
.
Count
;
j
++)
{
...
...
@@ -288,6 +299,30 @@ namespace Edu.Module.Exam
return
singleObj
;
}
public
string
CreateDefaultQuestion
(
RB_Course_Words_Extend
item
,
List
<
RB_Course_Words_Extend
>
totalList
,
List
<
optionItem
>
options
)
{
string
title
=
string
.
Format
(
"请选择【{0}】单词的正确中文意思."
,
item
.
WordContent
);
options
.
Add
(
new
optionItem
()
{
Content
=
item
.
ChineseMean
,
IsAnswer
=
true
,
Name
=
""
,
ShowName
=
""
});
for
(
var
i
=
0
;
i
<
3
;
i
++)
{
var
cItem
=
totalList
[
i
];
options
.
Add
(
new
optionItem
()
{
Content
=
!
string
.
IsNullOrEmpty
(
cItem
.
ChineseMean
)
?
cItem
.
ChineseMean
:
(
totalList
?.
FirstOrDefault
(
qitem
=>
!
string
.
IsNullOrEmpty
(
qitem
.
ChineseMean
))?.
ChineseMean
??
""
),
IsAnswer
=
false
,
Name
=
""
,
ShowName
=
""
,
});
}
return
title
;
}
/// <summary>
/// 单词学习或复习
/// </summary>
...
...
@@ -295,18 +330,18 @@ namespace Edu.Module.Exam
/// <param name="ChapterId">当前章节编号</param>
/// <param name="ReviewChapterId">复习章节编号</param>
/// <returns></returns>
public
object
GetStudyCourseWords
(
int
CourseId
,
int
ChapterId
,
int
ReviewChapterId
,
int
Stu_Account_Id
)
public
object
GetStudyCourseWords
(
int
CourseId
,
int
ChapterId
,
int
ReviewChapterId
,
int
Stu_Account_Id
)
{
List
<
object
>
list
=
new
List
<
object
>();
List
<
object
>
reviewList
=
new
List
<
object
>();
var
dataList
=
course_WordsRepository
.
GetCourseWordsListRepository
(
new
RB_Course_Words_Extend
()
{
CourseId
=
CourseId
,
QChapterIds
=
ChapterId
+
","
+
ReviewChapterId
QChapterIds
=
ChapterId
+
","
+
ReviewChapterId
});
if
(
dataList
!=
null
&&
dataList
.
Count
>
0
)
{
foreach
(
var
item
in
dataList
.
Where
(
qitem
=>
qitem
.
ChapterId
==
ChapterId
))
foreach
(
var
item
in
dataList
.
Where
(
qitem
=>
qitem
.
ChapterId
==
ChapterId
))
{
list
.
Add
(
new
{
...
...
@@ -376,7 +411,7 @@ namespace Edu.Module.Exam
var
wordsList
=
course_WordsRepository
.
GetCourseWordsListRepository
(
new
RB_Course_Words_Extend
()
{
CourseId
=
model
.
CourseId
,
QChapterIds
=
model
.
ChapterId
+
","
+
model
.
ReviewCourseChapterId
QChapterIds
=
model
.
ChapterId
+
","
+
model
.
ReviewCourseChapterId
});
//当前章节单词总数
var
currentChapterCount
=
wordsList
?.
Where
(
qitem
=>
qitem
.
ChapterId
==
model
.
ChapterId
)?.
Count
()
??
0
;
...
...
@@ -402,7 +437,7 @@ namespace Edu.Module.Exam
else
{
fileds
.
Add
(
nameof
(
RB_StuWords_Prep_Extend
.
ReviewNum
),
model
.
ReviewNum
);
model
.
StudyNum
=
oldModel
.
PrepNum
+
model
.
ReviewNum
;
model
.
StudyNum
=
oldModel
.
PrepNum
+
model
.
ReviewNum
;
}
fileds
.
Add
(
nameof
(
RB_StuWords_Prep_Extend
.
StudyNum
),
model
.
StudyNum
);
model
.
Score
=
GetScoreModule
(
model
.
PrepNum
,
currentChapterCount
);
...
...
@@ -438,7 +473,7 @@ namespace Edu.Module.Exam
int
score
=
0
;
if
(
TotalNum
>
0
)
{
var
progress
=
Convert
.
ToDecimal
(
StartNum
)
/
Convert
.
ToDecimal
(
TotalNum
)
*
100
;
var
progress
=
Convert
.
ToDecimal
(
StartNum
)
/
Convert
.
ToDecimal
(
TotalNum
)
*
100
;
if
(
progress
>
0
&&
progress
<=
33
)
{
score
=
1
;
...
...
Edu.Repository/Course/RB_Course_WordsRepository.cs
View file @
a43b8308
...
...
@@ -86,6 +86,10 @@ WHERE 1=1
{
builder
.
AppendFormat
(
" AND A.{0} IN({1}) "
,
nameof
(
RB_Course_Words_Extend
.
ChapterId
),
query
.
QChapterIds
);
}
if
(
query
.
LessThanOrEqualChapterId
>
0
)
{
builder
.
AppendFormat
(
" AND A.{0}<={1} "
,
nameof
(
RB_Course_Words_Extend
.
ChapterId
),
query
.
LessThanOrEqualChapterId
);
}
}
return
Get
<
RB_Course_Words_Extend
>(
builder
.
ToString
()).
ToList
();
}
...
...
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