master
xiaochanghai 11 months ago
parent 7db8d9b7de
commit ec4993b215
  1. 7
      Tiobon.Core.Model/ViewModels/Extend/Ghre_StudyRecordESS.cs
  2. 16
      Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs

@ -25,7 +25,7 @@ public class Ghre_StudyRecordESS
public int? StandardHour { get; set; } public int? StandardHour { get; set; }
public int? CreditPoints { get; set; } public int? CreditPoints { get; set; }
public string CourseBeginDate { get; set; } public DateTime? CourseBeginDate { get; set; }
public DateTime? CourseEndDate { get; set; } public DateTime? CourseEndDate { get; set; }
public DateTime? ExamDate { get; set; } public DateTime? ExamDate { get; set; }
public DateTime? ExamBeginDate { get; set; } public DateTime? ExamBeginDate { get; set; }
@ -38,9 +38,12 @@ public class Ghre_StudyRecordESS
public bool? ShowFeedbackBtn { get; set; } = true; public bool? ShowFeedbackBtn { get; set; } = true;
public bool? DisableFeedbackBtn { get; set; } = true; public bool? DisableFeedbackBtn { get; set; } = true;
public int StudyProgress { get; set; } = 0; public int? StudyProgress { get; set; } = 0;
public int? AfterHowLong { get; set; } public int? AfterHowLong { get; set; }
public string ExamDateType { get; set; } public string ExamDateType { get; set; }
public string CourseDateString { get; set; } public string CourseDateString { get; set; }
public string ExamDateString { get; set; } public string ExamDateString { get; set; }
public long? ExamId { get; set; }
} }

@ -202,7 +202,9 @@ namespace Tiobon.Core.Services
A.CourseSceneId, A.CourseSceneId,
A.CourseType, A.CourseType,
A.ExamDateType, A.ExamDateType,
A.AfterHowLong A.AfterHowLong,
A.StudyProgress,
A.ExamId
FROM Ghre_StudyRecord_V A"; FROM Ghre_StudyRecord_V A";
string conditions = $" WHERE UserId={App.User.ID} "; string conditions = $" WHERE UserId={App.User.ID} ";
@ -289,6 +291,7 @@ namespace Tiobon.Core.Services
sql += " WHERE NUM <= " + filter.pageNum * filter.pageSize + " AND NUM >" + (filter.pageNum - 1) * filter.pageSize; sql += " WHERE NUM <= " + filter.pageNum * filter.pageSize + " AND NUM >" + (filter.pageNum - 1) * filter.pageSize;
var entitys = await Db.Ado.SqlQueryAsync<Ghre_StudyRecordESS>(sql); var entitys = await Db.Ado.SqlQueryAsync<Ghre_StudyRecordESS>(sql);
var dt = DateTime.Now.Date;
entitys.ForEach(x => entitys.ForEach(x =>
{ {
if (x.CourseBeginDate != null && x.CourseEndDate != null) if (x.CourseBeginDate != null && x.CourseEndDate != null)
@ -296,6 +299,13 @@ namespace Tiobon.Core.Services
if (x.ExamBeginDate != null && x.ExamEndDate != null) if (x.ExamBeginDate != null && x.ExamEndDate != null)
x.ExamDateString = DateTimeHelper.ConvertToDayString(x.ExamBeginDate) + "~" + DateTimeHelper.ConvertToDayString(x.ExamEndDate); x.ExamDateString = DateTimeHelper.ConvertToDayString(x.ExamBeginDate) + "~" + DateTimeHelper.ConvertToDayString(x.ExamEndDate);
else x.ExamDateString = $"学完{x.AfterHowLong}天"; else x.ExamDateString = $"学完{x.AfterHowLong}天";
//if (x.CourseBeginDate != null && x.CourseEndDate != null)
// if (x.StudyProgress >= 100 || !(x.CourseBeginDate.Value.Date <= DateTime.Now.Date && x.CourseEndDate.Value.Date >= DateTime.Now.Date))
// x.DisableStudyBtn = true;
if (x.StudyProgress < 100 || x.ExamId.IsNull())
x.DisableExamBtn = true;
}); });
return new ServicePageResult<Ghre_StudyRecordESS>(filter.pageNum, total, filter.pageSize, entitys); return new ServicePageResult<Ghre_StudyRecordESS>(filter.pageNum, total, filter.pageSize, entitys);
@ -511,7 +521,7 @@ namespace Tiobon.Core.Services
if (mins > 0) if (mins > 0)
{ {
var duration = record.StudyDuration ?? 0; var duration = record.StudyDuration ?? 0;
studyProgress = (duration / mins)*100; studyProgress = (duration / mins) * 100;
if (studyProgress > 100) if (studyProgress > 100)
studyProgress = 100; studyProgress = 100;
} }
@ -522,4 +532,4 @@ namespace Tiobon.Core.Services
} }
#endregion #endregion
} }
} }
Loading…
Cancel
Save