From 839ae02e6910239547c5391e846aeec083fe2b93 Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Mon, 19 May 2025 10:24:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Ghre/Ghre_CourseServices.cs | 19 ++++++++-- .../Ghre/Ghre_StudyRecordServices.cs | 36 ++++++++++++------- 2 files changed, 41 insertions(+), 14 deletions(-) diff --git a/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs b/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs index 751388fb..a5d217ff 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs @@ -1516,7 +1516,14 @@ public class Ghre_CourseServices : BaseServices().Where(x => x.StudyRecordId != null && studyRecordIds.Contains(x.StudyRecordId.Value)).GroupBy(x => x.StaffId) .Select(m => new { m.StaffId, StudyDuration = SqlFunc.AggregateSum(m.StudyDuration) }).ToListAsync(); //平均学习时长 - data.AvgStudyDuration = AvgStudyDuration.Average(x => x.StudyDuration); + var AvgStudyDuration1 = AvgStudyDuration.Average(x => x.StudyDuration); + if (AvgStudyDuration1 != null) + { + + var AvgStudyDuration2 = AvgStudyDuration1.TrimDecimalString(2); + data.AvgStudyDuration = UtilHelper.RemoveZero(Convert.ToDecimal(AvgStudyDuration2)); + } + else data.AvgStudyDuration = 0; //平均分 var AvgScore = await Db.Queryable().Where(x => x.StudyRecordId != null && studyRecordIds.Contains(x.StudyRecordId.Value)).AvgAsync(x => x.FinallyScore ?? (x.Score + x.AdjustScore)); data.AvgScore = AvgScore ?? 0; @@ -1745,7 +1752,15 @@ public class Ghre_CourseServices : BaseServices().Where(x => x.StudyRecordId != null && studyRecordIds.Contains(x.StudyRecordId.Value)).GroupBy(x => x.StaffId) .Select(m => new { m.StaffId, StudyDuration = SqlFunc.AggregateSum(m.StudyDuration) }).ToListAsync(); //平均学习时长 - data.AvgStudyDuration = AvgStudyDuration.Average(x => x.StudyDuration); + //平均学习时长 + var AvgStudyDuration1 = AvgStudyDuration.Average(x => x.StudyDuration); + if (AvgStudyDuration1 != null) + { + + var AvgStudyDuration2 = AvgStudyDuration1.TrimDecimalString(2); + data.AvgStudyDuration = UtilHelper.RemoveZero(Convert.ToDecimal(AvgStudyDuration2)); + } + else data.AvgStudyDuration = 0; //平均分 var AvgScore = await Db.Queryable().Where(x => x.StudyRecordId != null && studyRecordIds.Contains(x.StudyRecordId.Value)).AvgAsync(x => x.FinallyScore ?? (x.Score + x.AdjustScore)); data.AvgScore = AvgScore ?? 0; diff --git a/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs b/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs index 1377a3fd..bf8ac7c6 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs @@ -805,6 +805,15 @@ public class Ghre_StudyRecordServices : BaseServices(sql); entity.SearchFields.Add(new CoursePublicSearchField() + { + label = "开班名称", + field = "OpenClassName", + elementType = "Input", + editable = true, + required = false, + multipleSelect = false, + }); + entity.SearchFields.Add(new CoursePublicSearchField() { label = "课程编号/名称", field = "CourseNoOrName", @@ -833,16 +842,16 @@ public class Ghre_StudyRecordServices : BaseServices