diff --git a/Tiobon.Core.Model/ViewModels/Extend/Ghre_StudyRecordESS.cs b/Tiobon.Core.Model/ViewModels/Extend/Ghre_StudyRecordESS.cs index d15006ff..21f9911d 100644 --- a/Tiobon.Core.Model/ViewModels/Extend/Ghre_StudyRecordESS.cs +++ b/Tiobon.Core.Model/ViewModels/Extend/Ghre_StudyRecordESS.cs @@ -25,7 +25,7 @@ public class Ghre_StudyRecordESS public int? StandardHour { get; set; } public int? CreditPoints { get; set; } - public string CourseBeginDate { get; set; } + public DateTime? CourseBeginDate { get; set; } public DateTime? CourseEndDate { get; set; } public DateTime? ExamDate { get; set; } public DateTime? ExamBeginDate { get; set; } @@ -38,9 +38,12 @@ public class Ghre_StudyRecordESS public bool? ShowFeedbackBtn { 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 string ExamDateType { get; set; } public string CourseDateString { get; set; } + public string ExamDateString { get; set; } + public long? ExamId { get; set; } + } diff --git a/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs b/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs index 8f1f2232..178ddccf 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs @@ -202,7 +202,9 @@ namespace Tiobon.Core.Services A.CourseSceneId, A.CourseType, A.ExamDateType, - A.AfterHowLong + A.AfterHowLong, + A.StudyProgress, + A.ExamId FROM Ghre_StudyRecord_V A"; 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; var entitys = await Db.Ado.SqlQueryAsync(sql); + var dt = DateTime.Now.Date; entitys.ForEach(x => { if (x.CourseBeginDate != null && x.CourseEndDate != null) @@ -296,6 +299,13 @@ namespace Tiobon.Core.Services if (x.ExamBeginDate != null && x.ExamEndDate != null) x.ExamDateString = DateTimeHelper.ConvertToDayString(x.ExamBeginDate) + "~" + DateTimeHelper.ConvertToDayString(x.ExamEndDate); 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(filter.pageNum, total, filter.pageSize, entitys); @@ -511,7 +521,7 @@ namespace Tiobon.Core.Services if (mins > 0) { var duration = record.StudyDuration ?? 0; - studyProgress = (duration / mins)*100; + studyProgress = (duration / mins) * 100; if (studyProgress > 100) studyProgress = 100; } @@ -522,4 +532,4 @@ namespace Tiobon.Core.Services } #endregion } -} \ No newline at end of file +} \ No newline at end of file