Commit 563b9bc0 authored by liudong1993's avatar liudong1993

Merge branch 'master' of http://gitlab.oytour.com/Kui2/education

parents 0d523f36 05f6c2ee
......@@ -277,7 +277,7 @@ namespace Edu.Common
/// <returns></returns>
public static int CalcMinutes(DateTime start, DateTime end)
{
int minutes=Convert.ToInt32((end - start).TotalSeconds);
int minutes = Convert.ToInt32((end - start).TotalSeconds);
minutes /= 60;
return minutes;
}
......@@ -387,7 +387,7 @@ namespace Edu.Common
/// <param name="value"></param>
/// <param name="isAddNbsp"></param>
/// <returns></returns>
public static string GetSpanString(string value,bool isAddNbsp=false)
public static string GetSpanString(string value, bool isAddNbsp = false)
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"<span style='text-decoration: underline;'>{1}{0}{1}</span>", value, (isAddNbsp ? "&nbsp;&nbsp;" : ""));
......@@ -520,5 +520,16 @@ namespace Edu.Common
}
return FormatDate(last);
}
/// <summary>
/// 生成随机数
/// </summary>
/// <returns></returns>
public static int CreateRandomNum()
{
Random rd = new Random();
int result = rd.Next(1, 100);
return result % 4;
}
}
}
\ No newline at end of file
......@@ -40,11 +40,11 @@ namespace Edu.Model.ViewModel.Exam
/// <summary>
/// 考试开始时间
/// </summary>
public DateTime ExamStartTime { get; set; }
public DateTime PaperStartTime { get; set; }
/// <summary>
/// 考试结束时间
/// </summary>
public DateTime EndTime { get; set; }
public DateTime PaperEndTime { get; set; }
}
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using Edu.Model.ViewModel.Question;
namespace Edu.Module.Exam
{
......@@ -25,7 +26,7 @@ namespace Edu.Module.Exam
/// <param name="ChapterId"></param>
/// <param name="NextChapterId"></param>
/// <returns></returns>
public object CreateCourseExam(int CourseId,int ChapterId,int NextChapterId)
public object CreateCourseExam(int CourseId, int ChapterId, int NextChapterId)
{
object result = new object();
var list = course_WordsRepository.GetCourseWordsListRepository(new RB_Course_Words_Extend()
......@@ -33,25 +34,78 @@ namespace Edu.Module.Exam
CourseId = CourseId,
QChapterIds = ChapterId + "," + NextChapterId
});
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>();
List<object> prepGroupList = new List<object>();
if (reviewList != null && reviewList.Count > 0)
{
for (var i = 0; i < reviewList.Count; i++)
{
//选择题
if (i % 2 == 0)
{
{
string title = "我是问题";
int randNum = Common.ConvertHelper.CreateRandomNum();
switch (randNum)
{
//根据单词选择中文意思
case 0:
break;
//根据中文意思选择单词
case 1:
break;
//根据日语书写选择中文意思
case 2:
break;
//根据中文意思选日语书写
case 3:
break;
}
List<optionItem> options = new List<optionItem>();
reviewGroupList.Add(new
{
QuestionTypeName = "单选题",
QuestionTypeId = 1,
QuestionTypeKey = "single",
QuestionContent = options,
Title = title
});
}
//填空题
else
{
string title = "我是问题";
List<fillInItem> fillInItems = new List<fillInItem>();
reviewGroupList.Add(new
{
QuestionTypeName = "填空题",
QuestionTypeId = 3,
QuestionTypeKey = "fill-in",
QuestionContent = fillInItems,
Title = title
});
}
}
}
if (prepList != null && prepList.Count > 0)
{
{
}
result = new
{
reviewGroupList,
prepGroupList,
};
return result;
}
}
......
......@@ -1634,17 +1634,30 @@ namespace Edu.Module.Exam
/// <returns></returns>
public virtual bool SetStuExamStartTimeModule(int PublishId, int GuestId, int PaperId)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
bool flag = false;
var model = examination_StudentRepository.GetExaminationStudentListRepository(new RB_Examination_Student_ViewModel()
{
{nameof(RB_Examination_Student_ViewModel.ExamStartTime), DateTime.Now},
};
List<WhereHelper> wheres = new List<WhereHelper>()
PaperId = PaperId,
PublishId = PublishId,
GuestId = GuestId
})?.FirstOrDefault();
if (model != null)
{
new WhereHelper(nameof(RB_Examination_Student_ViewModel.PaperId),PaperId),
new WhereHelper(nameof(RB_Examination_Student_ViewModel.PublishId),PublishId),
new WhereHelper(nameof(RB_Examination_Student_ViewModel.GuestId),GuestId),
};
bool flag = examination_StudentRepository.Update(fileds, wheres);
if (model.ExamStartTime == null)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
{nameof(RB_Examination_Student_ViewModel.ExamStartTime), DateTime.Now},
};
List<WhereHelper> wheres = new List<WhereHelper>()
{
new WhereHelper(nameof(RB_Examination_Student_ViewModel.PaperId),PaperId),
new WhereHelper(nameof(RB_Examination_Student_ViewModel.PublishId),PublishId),
new WhereHelper(nameof(RB_Examination_Student_ViewModel.GuestId),GuestId),
};
flag = examination_StudentRepository.Update(fileds, wheres);
}
}
return flag;
}
......
......@@ -24,7 +24,7 @@ namespace Edu.Repository.Exam
{
StringBuilder builder = new StringBuilder();
builder.AppendFormat(@"
SELECT A.*,IFNULL(B.GuestName,'') AS GuestName,c.ClassName,b.Mobile,s.StuIcon,p.ExamStartTime ,p.ExamEndTime AS EndTime
SELECT A.*,IFNULL(B.GuestName,'') AS GuestName,c.ClassName,b.Mobile,s.StuIcon,p.ExamStartTime AS PaperStartTime,p.ExamEndTime AS PaperEndTime
FROM RB_Examination_Student AS A LEFT JOIN rb_order_guest AS B ON A.GuestId=B.Id
LEFT JOIN rb_class as c on c.ClassId=a.ClassId
LEFT JOIN rb_student_orderguest as sog on sog.GuestId=a.GuestId
......
......@@ -110,7 +110,7 @@ namespace Edu.WebApi.Controllers.Applet
classModel = new Model.ViewModel.Grade.RB_Class_Time_Extend();
}
#region 我的试卷
List<Model.ViewModel.Exam.RB_Examination_Publish_ViewModel> examinationPublishList = new List<Model.ViewModel.Exam.RB_Examination_Publish_ViewModel>();
List<RB_Examination_Publish_ViewModel> examinationPublishList = new List<RB_Examination_Publish_ViewModel>();
if (studentModel != null && studentModel.GuestId > 0)
{
examinationPublishList = paperModule.GetGuestExaminationPublishPage(1, 5, out long rowsCount,
......
......@@ -854,18 +854,18 @@ namespace Edu.WebApi.Controllers.Exam
var list = paperModule.GetExaminationStudentPageRepository(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
foreach (var item in list)
{
if (item.ExamStartTime > System.DateTime.Now)
if (item.PaperStartTime > System.DateTime.Now)
{
item.ExamStatus = ExamTestStatusEnum.NotStarted;
}
else if (item.ExamStartTime < System.DateTime.Now && item.EndTime > System.DateTime.Now)
else if (item.PaperStartTime < System.DateTime.Now && item.PaperEndTime > System.DateTime.Now)
{
if (item.ExamStatus != ExamTestStatusEnum.FinishTest && item.ExamStatus != ExamTestStatusEnum.FinishScoring)
{
item.ExamStatus = ExamTestStatusEnum.FinishStarted;
}
}
else if (item.EndTime < System.DateTime.Now)
else if (item.PaperEndTime < System.DateTime.Now)
{
if (item.ExamStatus != ExamTestStatusEnum.FinishTest && item.ExamStatus != ExamTestStatusEnum.FinishScoring)
{
......@@ -888,8 +888,10 @@ namespace Edu.WebApi.Controllers.Exam
CreateByName = UserReidsCache.GetUserLoginInfo(item.CreateBy)?.AccountName ?? "",
item.ExamStatus,
ExamStatusName = item.ExamStatus.ToName(),
ExamStartTime = Common.ConvertHelper.FormatTime(item.ExamStartTime),
EndTime = Common.ConvertHelper.FormatTime(item.EndTime),
ExamStartTime= Common.ConvertHelper.FormatTime(item.ExamStartTime),
ExamEndTime = Common.ConvertHelper.FormatTime(item.ExamEndTime),
PaperStartTime = Common.ConvertHelper.FormatTime(item.PaperStartTime),
PaperEndTime = Common.ConvertHelper.FormatTime(item.PaperEndTime),
};
result.Add(obj);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment