Commit 1628c8d6 authored by 黄奎's avatar 黄奎

页面修改

parent 2d730f50
......@@ -291,6 +291,37 @@ namespace Edu.Common
return minutes;
}
/// <summary>
/// 计算时分秒
/// </summary>
/// <param name="start"></param>
/// <param name="end"></param>
/// <returns></returns>
public static string CalcMinutesAndSeconds(DateTime start, DateTime end)
{
string dateDiff = null;
TimeSpan ts1 = new TimeSpan(start.Ticks);
TimeSpan ts2 = new TimeSpan(end.Ticks);
TimeSpan ts = ts1.Subtract(ts2).Duration();
if (ts.Days > 0)
{
dateDiff += ts.Days.ToString() + "天";
}
if (ts.Hours > 0)
{
dateDiff += ts.Hours.ToString() + "小时";
}
if (ts.Minutes > 0)
{
dateDiff += ts.Minutes.ToString() + "分";
}
if (ts.Seconds > 0)
{
dateDiff += ts.Seconds.ToString() + "秒";
}
return dateDiff;
}
/// <summary>
/// 是否为时间型字符串
/// </summary>
......
......@@ -33,5 +33,10 @@ namespace Edu.Model.ViewModel.Question
/// </summary>
public int QuestionCount { get; set; }
/// <summary>
/// 学员编号
/// </summary>
public int StudentId { get; set; }
}
}
......@@ -847,10 +847,20 @@ namespace Edu.Module.Exam
{
var tempList = stuExamList?.Where(qitem => qitem.BankId == item.BankId)?.ToList();
string LeastTime = "";
decimal HighestScore = 0;
string MyUseTime = "";
decimal MyScore = 0;
if (tempList != null)
{
var least = tempList?.OrderBy(qitem => qitem.ExamMinutes)?.FirstOrDefault();
LeastTime = Common.ConvertHelper.CalcMinutesAndSeconds(least.StartTime, least.EndTime);
HighestScore = tempList?.Max(qitem => qitem.Score)??0;
var myLast= tempList?.Where(qitem=>qitem.StudentId==query.StudentId).OrderByDescending(qitem =>qitem.Id)?.FirstOrDefault();
if (myLast != null)
{
MyUseTime = Common.ConvertHelper.CalcMinutesAndSeconds(myLast.StartTime, myLast.EndTime);
MyScore = myLast.Score;
}
}
var obj = new
{
......@@ -858,9 +868,9 @@ namespace Edu.Module.Exam
item.BankName,
JoinNum = tempList?.Count(),
LeastTime,
HighestScore = new Random().Next(1, 100),
MyUseTime = "55:55",
MyScore = new Random().Next(1, 100),
HighestScore,
MyUseTime,
MyScore,
MyRank = new Random().Next(1, 10),
};
result.Add(obj);
......@@ -933,7 +943,7 @@ namespace Edu.Module.Exam
}
catch (Exception ex)
{
Common.Plugin.LogHelper.Write(ex, "GetAppQuestionCategoryListModule_:" + Common.Plugin.JsonHelper.Serialize(item));
Common.Plugin.LogHelper.Write(ex, "GetAppBankDetailsPageModule_Item:" + Common.Plugin.JsonHelper.Serialize(item));
}
}
}
......@@ -991,6 +1001,32 @@ namespace Edu.Module.Exam
}
return flag;
}
/// <summary>
/// 新增修改学员考试练习
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public bool SetStudentExamModule(RB_Student_Exam_Extend model)
{
bool flag = false;
if (model.Id > 0)
{
Dictionary<string, object> fileds = new Dictionary<string, object>()
{
};
flag = student_ExamRepository.Update(fileds, new WhereHelper(nameof(RB_Student_Exam_Extend.Id), model.Id));
}
else
{
var newId = student_ExamRepository.Insert(model);
model.Id = newId;
flag = newId > 0;
}
return flag;
}
#endregion
}
}
......@@ -1067,6 +1067,7 @@ namespace Edu.WebApi.Controllers.Exam
{
BankType = (LevelTypeEnum)base.ParmJObj.GetInt("BankType"),
};
query.StudentId = base.ParmJObj.GetInt("StudentId");
var list = courseExamModule.GetAppBankPageModule(pageModel.PageIndex, pageModel.PageSize, out long rowsCount, query);
pageModel.Count = rowsCount;
pageModel.PageData = list;
......
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