学习考试
This commit is contained in:
parent
f3e7713083
commit
b675dc1cb6
|
@ -266,19 +266,19 @@ namespace BLL
|
|||
|
||||
public static string CreateTestRecordItem(Model.Training_CompanyTrainingItem getCompanyTraining, string testRecordId, Model.SitePerson_Person person, Model.Sys_User user)
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var trainingIds = getCompanyTraining.TestTrainingIds.Split(',');
|
||||
var testTrainings= db.Training_TestTraining.Where(x => trainingIds.Contains(x.TrainingId));
|
||||
var testTrainings = db.Training_TestTraining.Where(x => trainingIds.Contains(x.TrainingId));
|
||||
var getTestRecord = db.Training_TestRecord.FirstOrDefault(x => x.TestRecordId == testRecordId);
|
||||
if (getTestRecord != null && !getTestRecord.TestStartTime.HasValue)
|
||||
{
|
||||
////考试时长
|
||||
getTestRecord.Duration =120;
|
||||
getTestRecord.Duration = 120;
|
||||
getTestRecord.TestStartTime = DateTime.Now;
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
@ -293,16 +293,16 @@ namespace BLL
|
|||
// select x;
|
||||
//// 计划考试中单选、多选、判断题总数
|
||||
var sysTestRule = Funs.DB.Sys_TestRule.FirstOrDefault();
|
||||
|
||||
|
||||
int sumTestType1Count = 0;// testPlanTrainings.Sum(x => x.TestType1Count) ?? 0;
|
||||
int sumTestType2Count = 0;//testPlanTrainings.Sum(x => x.TestType2Count) ?? 0;
|
||||
int sumTestType3Count = 0;//testPlanTrainings.Sum(x => x.TestType3Count) ?? 0;
|
||||
if (sysTestRule != null)
|
||||
{
|
||||
|
||||
|
||||
sumTestType1Count = sysTestRule.SCount;
|
||||
sumTestType2Count = sysTestRule.MCount;
|
||||
sumTestType3Count = sysTestRule.JCount;
|
||||
sumTestType3Count = sysTestRule.JCount;
|
||||
}
|
||||
////获取类型下适合岗位试题集合
|
||||
List<Model.Training_TestTrainingItem> getTestTrainingItemALLs;
|
||||
|
@ -318,7 +318,7 @@ namespace BLL
|
|||
}
|
||||
|
||||
getTestTrainingItemALLs = (from x in db.Training_TestTrainingItem
|
||||
where x.TrainingId != null && (x.WorkPostIds == null || string.IsNullOrEmpty(WorkPostId) || x.WorkPostIds.Contains(WorkPostId)) || (x.DepartIds == null || string.IsNullOrEmpty(DepartId) || x.DepartIds.Contains(DepartId))
|
||||
where x.TrainingId != null && (x.WorkPostIds == null || string.IsNullOrEmpty(WorkPostId) || x.WorkPostIds.Contains(WorkPostId)) || (x.DepartIds == null || string.IsNullOrEmpty(DepartId) || x.DepartIds.Contains(DepartId))
|
||||
select x).ToList();
|
||||
foreach (var itemT in testTrainings)
|
||||
{
|
||||
|
@ -347,9 +347,9 @@ namespace BLL
|
|||
}
|
||||
}
|
||||
//// 获取得到的单选题、多选题、判断题 数量
|
||||
int getDiffTestType1Count = sumTestType1Count;// - getTestTrainingItemList.Where(x => x.TestType == "1").Count();
|
||||
int getDiffTestType2Count = sumTestType2Count;// - getTestTrainingItemList.Where(x => x.TestType == "2").Count();
|
||||
int getDiffTestType3Count = sumTestType3Count;// - getTestTrainingItemList.Where(x => x.TestType == "3").Count();
|
||||
int getDiffTestType1Count = sumTestType1Count - getTestTrainingItemList.Where(x => x.TestType == "1").Count();
|
||||
int getDiffTestType2Count = sumTestType2Count - getTestTrainingItemList.Where(x => x.TestType == "2").Count();
|
||||
int getDiffTestType3Count = sumTestType3Count - getTestTrainingItemList.Where(x => x.TestType == "3").Count();
|
||||
if (getDiffTestType1Count > 0 || getDiffTestType2Count > 0 || getDiffTestType3Count > 0)
|
||||
{
|
||||
var getTestTrainingItemNulls = getTestTrainingItemALLs.Where(x => x.WorkPostIds == null).ToList();
|
||||
|
@ -365,7 +365,7 @@ namespace BLL
|
|||
{
|
||||
getTestTrainingItemList.AddRange(getSItemD);
|
||||
}
|
||||
}
|
||||
}
|
||||
///多选题
|
||||
if (getDiffTestType2Count > 0)
|
||||
{
|
||||
|
|
|
@ -85,6 +85,8 @@ namespace BLL
|
|||
GetDataService.CreateTrainingTaskItemByTaskId(taskId);
|
||||
|
||||
var getDataLists = (from x in db.Training_TaskItem
|
||||
join y in db.Training_CompanyTrainingItem on x.TrainingItemCode equals y.CompanyTrainingItemCode into temp
|
||||
from y in temp.DefaultIfEmpty()
|
||||
where x.TaskId == taskId
|
||||
orderby x.TrainingItemCode
|
||||
select new Model.TrainingTaskItemItem
|
||||
|
@ -94,7 +96,8 @@ namespace BLL
|
|||
PlanId = x.PlanId,
|
||||
StartTime = x.StartTime,
|
||||
EndTime =x.EndTime,
|
||||
LearningTime=x.LearnTime,
|
||||
LearningTime= x.LearnTime,
|
||||
AttachTime= y.LearningTime,
|
||||
VideoProgress = x.VideoProgress,
|
||||
PersonId = x.PersonId,
|
||||
TrainingItemCode = x.TrainingItemCode,
|
||||
|
@ -305,21 +308,23 @@ namespace BLL
|
|||
{
|
||||
item.LearnTime = 0;
|
||||
}
|
||||
item.LearnTime = item.LearnTime.Value + (int)span.TotalMinutes;
|
||||
|
||||
item.LearnTime = item.LearnTime.Value + (int)span.TotalSeconds;
|
||||
item.EndTime = endTime;
|
||||
|
||||
db.SubmitChanges();
|
||||
|
||||
var companyTrainingItem = db.Training_CompanyTrainingItem.FirstOrDefault(x => x.CompanyTrainingItemCode == item.TrainingItemCode);
|
||||
int companyTrainingItemLearnTime = companyTrainingItem?.LearningTime ?? 0; //培训教材时长(秒)
|
||||
|
||||
|
||||
//如果学习时长大于培训教材时长,则关闭状态
|
||||
if (item.VideoProgress > item.LearnTime)
|
||||
if (item.LearnTime > companyTrainingItemLearnTime)
|
||||
{
|
||||
var taskModel = db.Training_Task.FirstOrDefault(x => x.TaskId == item.TaskId);
|
||||
taskModel.States = "2";
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,8 @@ namespace BLL
|
|||
PersonId = item.UserId,
|
||||
TrainingItemCode = dataItem.TrainingItemCode,
|
||||
TrainingItemName = dataItem.TrainingItemName,
|
||||
LearnTime = dataItem.LearningTime,
|
||||
// LearnTime = dataItem.LearningTime,//秒 注释原因(2024-5-24):存储过程LearningTime是教材时长培训任务教材明细表中的学习时间字段LearnTime,不能复用)
|
||||
LearnTime =0,
|
||||
AttachUrl = dataItem.AttachUrl,
|
||||
};
|
||||
|
||||
|
|
|
@ -87,22 +87,38 @@ namespace Model
|
|||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 开始时间
|
||||
/// </summary>
|
||||
public DateTime? StartTime
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
/// <summary>
|
||||
/// 学习时长(秒)
|
||||
/// </summary>
|
||||
public int? LearningTime
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public DateTime? EndTime
|
||||
/// <summary>
|
||||
/// 教材时长(秒)
|
||||
/// </summary>
|
||||
public int? AttachTime
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public DateTime? EndTime
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
/// <summary>
|
||||
/// 视频进度(秒)
|
||||
/// </summary>
|
||||
public int? VideoProgress
|
||||
{
|
||||
get;
|
||||
|
|
|
@ -128,7 +128,14 @@ namespace WebAPI.Controllers
|
|||
}
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 修改培训任务教材明细学习时间
|
||||
/// </summary>
|
||||
/// <param name="taskItemId"></param>
|
||||
/// <param name="startTime"></param>
|
||||
/// <param name="endTime"></param>
|
||||
/// <param name="VideoProgress"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public Model.ResponeData updateTaskItemLearnTime(string taskItemId, DateTime startTime, DateTime endTime,string VideoProgress)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue