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
1a7b8519
Commit
1a7b8519
authored
Jan 13, 2022
by
黄奎
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
单词测试算法修改
parent
3cb85c96
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
83 additions
and
38 deletions
+83
-38
CourseExamModule.cs
Edu.Module.Exam/CourseExamModule.cs
+83
-38
No files found.
Edu.Module.Exam/CourseExamModule.cs
View file @
1a7b8519
...
@@ -74,30 +74,30 @@ namespace Edu.Module.Exam
...
@@ -74,30 +74,30 @@ namespace Edu.Module.Exam
var
titleRandomNum
=
Common
.
ConvertHelper
.
CreateRandomNum
();
var
titleRandomNum
=
Common
.
ConvertHelper
.
CreateRandomNum
();
var
tempWords
=
reviewList
[
i
];
var
tempWords
=
reviewList
[
i
];
var
count
=
totalList
?.
Where
(
qitem
=>
qitem
.
Id
!=
tempWords
.
Id
)?.
Count
()??
0
;
var
count
=
totalList
?.
Where
(
qitem
=>
qitem
.
Id
!=
tempWords
.
Id
)?.
Count
()??
0
;
//
reviewGroupList.Add(CreateSingleModule(tempWords,totalList));
reviewGroupList
.
Add
(
CreateSingleModule
(
tempWords
,
totalList
));
//选择题
//选择题
if
(
titleRandomNum
%
2
==
0
)
//
if (titleRandomNum % 2 == 0)
{
//
{
if
(
count
>
2
)
//
if (count > 2)
{
//
{
reviewGroupList
.
Add
(
CreateSingleModule
(
tempWords
,
totalList
));
//
reviewGroupList.Add(CreateSingleModule(tempWords, totalList));
}
//
}
else
//
else
{
//
{
if
(!
string
.
IsNullOrEmpty
(
tempWords
.
ChineseMean
)
||
!
string
.
IsNullOrEmpty
(
tempWords
.
WordWrite
))
//
if (!string.IsNullOrEmpty(tempWords.ChineseMean) || !string.IsNullOrEmpty(tempWords.WordWrite))
{
//
{
reviewGroupList
.
Add
(
CreateFillInModule
(
tempWords
));
//
reviewGroupList.Add(CreateFillInModule(tempWords));
}
//
}
}
//
}
}
//
}
//填空题
//
//
填空题
else
//
else
{
//
{
if
(!
string
.
IsNullOrEmpty
(
tempWords
.
ChineseMean
)
||
!
string
.
IsNullOrEmpty
(
tempWords
.
WordWrite
))
//
if (!string.IsNullOrEmpty(tempWords.ChineseMean) || !string.IsNullOrEmpty(tempWords.WordWrite))
{
//
{
reviewGroupList
.
Add
(
CreateFillInModule
(
tempWords
));
//
reviewGroupList.Add(CreateFillInModule(tempWords));
}
//
}
}
//
}
}
}
}
}
...
@@ -195,17 +195,24 @@ namespace Edu.Module.Exam
...
@@ -195,17 +195,24 @@ namespace Edu.Module.Exam
for
(
var
i
=
0
;
i
<
3
;
i
++)
for
(
var
i
=
0
;
i
<
3
;
i
++)
{
{
var
cItem
=
tempList
[
i
];
var
cItem
=
tempList
[
i
];
string
Content
=
cItem
.
WordContent
;
if
(
string
.
IsNullOrEmpty
(
Content
))
{
var
cTempList
=
totalList
?.
Where
(
qitem
=>
qitem
.
Id
!=
cItem
.
Id
&&
qitem
.
Id
!=
item
.
Id
&&
!
string
.
IsNullOrEmpty
(
qitem
.
WordContent
))?.
OrderBy
(
qitem
=>
Guid
.
NewGuid
());
Content
=
cTempList
?.
FirstOrDefault
()?.
WordContent
??
""
;
}
if
(
options
.
Where
(
qitem
=>
qitem
.
Content
.
Equals
(
Content
)).
Count
()
>
0
)
{
Content
+=
GetRandWords
(
i
);
}
options
.
Add
(
new
optionItem
()
options
.
Add
(
new
optionItem
()
{
{
Content
=
!
string
.
IsNullOrEmpty
(
cItem
.
WordContent
)
Content
=
Content
,
?
cItem
.
WordContent
:
(
totalList
?.
FirstOrDefault
(
qitem
=>
qitem
.
Id
!=
item
.
Id
&&!
string
.
IsNullOrEmpty
(
qitem
.
WordContent
))?.
WordContent
??
""
),
IsAnswer
=
false
,
IsAnswer
=
false
,
Name
=
""
,
Name
=
""
,
ShowName
=
""
,
ShowName
=
""
,
});
});
}
}
break
;
break
;
//根据日语书写选择中文意思
//根据日语书写选择中文意思
case
2
:
case
2
:
...
@@ -222,11 +229,18 @@ namespace Edu.Module.Exam
...
@@ -222,11 +229,18 @@ namespace Edu.Module.Exam
for
(
var
i
=
0
;
i
<
3
;
i
++)
for
(
var
i
=
0
;
i
<
3
;
i
++)
{
{
var
cItem
=
tempList
[
i
];
var
cItem
=
tempList
[
i
];
string
Content
=
cItem
.
WordContent
;
if
(
string
.
IsNullOrEmpty
(
Content
))
{
Content
=
(
totalList
?.
OrderBy
(
qitem
=>
Guid
.
NewGuid
())?.
FirstOrDefault
(
qitem
=>
qitem
.
Id
!=
cItem
.
Id
&&
qitem
.
Id
!=
item
.
Id
&&
!
string
.
IsNullOrEmpty
(
qitem
.
WordContent
))?.
WordContent
??
""
);
}
if
(
options
.
Where
(
qitem
=>
qitem
.
Content
.
Equals
(
Content
)).
Count
()
>
0
)
{
Content
+=
GetRandWords
(
i
);
}
options
.
Add
(
new
optionItem
()
options
.
Add
(
new
optionItem
()
{
{
Content
=
!
string
.
IsNullOrEmpty
(
cItem
.
WordContent
)
Content
=
Content
,
?
cItem
.
WordContent
:
(
totalList
?.
FirstOrDefault
(
qitem
=>
qitem
.
Id
!=
item
.
Id
&&!
string
.
IsNullOrEmpty
(
qitem
.
WordContent
))?.
WordContent
??
""
),
IsAnswer
=
false
,
IsAnswer
=
false
,
Name
=
""
,
Name
=
""
,
ShowName
=
""
,
ShowName
=
""
,
...
@@ -253,11 +267,21 @@ namespace Edu.Module.Exam
...
@@ -253,11 +267,21 @@ namespace Edu.Module.Exam
for
(
var
i
=
0
;
i
<
3
;
i
++)
for
(
var
i
=
0
;
i
<
3
;
i
++)
{
{
var
cItem
=
tempList
[
i
];
var
cItem
=
tempList
[
i
];
string
Content
=
cItem
.
WordWrite
;
if
(
string
.
IsNullOrEmpty
(
Content
))
{
Content
=
totalList
?.
OrderBy
(
qitem
=>
Guid
.
NewGuid
())
?.
FirstOrDefault
(
qitem
=>
qitem
.
Id
!=
cItem
.
Id
&&
qitem
.
Id
!=
item
.
Id
&&
!
string
.
IsNullOrEmpty
(
qitem
.
WordWrite
))
?.
WordWrite
??
""
;
}
if
(
options
.
Where
(
qitem
=>
qitem
.
Content
.
Equals
(
Content
)).
Count
()
>
0
)
{
Content
+=
GetRandWords
(
i
);
}
options
.
Add
(
new
optionItem
()
options
.
Add
(
new
optionItem
()
{
{
Content
=
!
string
.
IsNullOrEmpty
(
cItem
.
WordWrite
)
Content
=
Content
,
?
cItem
.
WordWrite
:(
totalList
?.
FirstOrDefault
(
qitem
=>
qitem
.
Id
!=
item
.
Id
&&!
string
.
IsNullOrEmpty
(
qitem
.
WordWrite
))?.
WordWrite
??
""
),
IsAnswer
=
false
,
IsAnswer
=
false
,
Name
=
""
,
Name
=
""
,
ShowName
=
""
,
ShowName
=
""
,
...
@@ -270,10 +294,8 @@ namespace Edu.Module.Exam
...
@@ -270,10 +294,8 @@ namespace Edu.Module.Exam
}
}
break
;
break
;
}
}
options
=
options
?.
OrderBy
(
qitem
=>
Guid
.
NewGuid
())?.
ToList
();
options
=
options
?.
OrderBy
(
qitem
=>
Guid
.
NewGuid
())?.
ToList
();
string
Answer
=
""
;
string
Answer
=
""
;
for
(
var
j
=
1
;
j
<=
options
.
Count
;
j
++)
for
(
var
j
=
1
;
j
<=
options
.
Count
;
j
++)
{
{
...
@@ -304,6 +326,18 @@ namespace Edu.Module.Exam
...
@@ -304,6 +326,18 @@ namespace Edu.Module.Exam
return
singleObj
;
return
singleObj
;
}
}
/// <summary>
/// 获取随机假名
/// </summary>
/// <param name="index"></param>
/// <returns></returns>
public
string
GetRandWords
(
int
index
)
{
var
array
=
new
string
[
4
]
{
"ん"
,
"ー"
,
"ム"
,
"い"
};
return
array
[
index
];
}
/// <summary>
/// <summary>
/// 生成默认的选择题
/// 生成默认的选择题
/// </summary>
/// </summary>
...
@@ -324,10 +358,21 @@ namespace Edu.Module.Exam
...
@@ -324,10 +358,21 @@ namespace Edu.Module.Exam
for
(
var
i
=
0
;
i
<
3
;
i
++)
for
(
var
i
=
0
;
i
<
3
;
i
++)
{
{
var
cItem
=
totalList
[
i
];
var
cItem
=
totalList
[
i
];
string
Content
=
cItem
.
ChineseMean
;
if
(
string
.
IsNullOrEmpty
(
Content
))
{
Content
=
totalList
?.
OrderBy
(
qitem
=>
Guid
.
NewGuid
())
?.
FirstOrDefault
(
qitem
=>
qitem
.
Id
!=
cItem
.
Id
&&
qitem
.
Id
!=
item
.
Id
&&
!
string
.
IsNullOrEmpty
(
qitem
.
ChineseMean
))
?.
ChineseMean
??
""
;
}
if
(
options
.
Where
(
qitem
=>
qitem
.
Content
.
Equals
(
Content
)).
Count
()
>
0
)
{
Content
+=
GetRandWords
(
i
);
}
options
.
Add
(
new
optionItem
()
options
.
Add
(
new
optionItem
()
{
{
Content
=
!
string
.
IsNullOrEmpty
(
cItem
.
ChineseMean
)
?
cItem
.
ChineseMean
:
Content
=
Content
,
(
totalList
?.
FirstOrDefault
(
qitem
=>
qitem
.
Id
!=
item
.
Id
&&
!
string
.
IsNullOrEmpty
(
qitem
.
ChineseMean
))?.
ChineseMean
??
""
),
IsAnswer
=
false
,
IsAnswer
=
false
,
Name
=
""
,
Name
=
""
,
ShowName
=
""
,
ShowName
=
""
,
...
...
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