diff --git a/Tiobon.Core.Api/Tiobon.Core.Model.xml b/Tiobon.Core.Api/Tiobon.Core.Model.xml
index 66975c7f..7d5b30aa 100644
--- a/Tiobon.Core.Api/Tiobon.Core.Model.xml
+++ b/Tiobon.Core.Api/Tiobon.Core.Model.xml
@@ -41045,7 +41045,7 @@
- 培训记录-学习状态
+ 培训记录-完成状态
diff --git a/Tiobon.Core.Model/Consts.cs b/Tiobon.Core.Model/Consts.cs
index b8b27d31..d19f9579 100644
--- a/Tiobon.Core.Model/Consts.cs
+++ b/Tiobon.Core.Model/Consts.cs
@@ -271,9 +271,9 @@ public class Consts
#endregion
- #region 培训记录-学习状态
+ #region 培训记录-完成状态
///
- /// 培训记录-学习状态
+ /// 培训记录-完成状态
///
public static class DIC_STUDY_RECORD_STUDY_COMPLETE_STATUS
diff --git a/Tiobon.Core.Model/ViewModels/Extend/CourseAndScene.cs b/Tiobon.Core.Model/ViewModels/Extend/CourseAndScene.cs
index 5d1b21e5..02ffd9b1 100644
--- a/Tiobon.Core.Model/ViewModels/Extend/CourseAndScene.cs
+++ b/Tiobon.Core.Model/ViewModels/Extend/CourseAndScene.cs
@@ -6,4 +6,13 @@ public class CourseAndScene
public string CourseNo { get; set; }
public string Type { get; set; }
public string CourseName { get; set; }
+ public int RequiredCount { get; set; } = 0;
+
+ public int ElectiveCount { get; set; } = 0;
+ public int CompleteCount { get; set; } = 0;
+ public int OpenClassCount { get; set; } = 0;
+ public decimal? TotalStudyDuration { get; set; } = 0;
+ public string AvgStudyDuration { get; set; } = "0";
+ public decimal? AvgScore { get; set; } = 0;
+ public decimal PassPercent { get; set; } = 0;
}
diff --git a/Tiobon.Core.Services/CommonServices.cs b/Tiobon.Core.Services/CommonServices.cs
index c77cc156..f2043418 100644
--- a/Tiobon.Core.Services/CommonServices.cs
+++ b/Tiobon.Core.Services/CommonServices.cs
@@ -858,8 +858,19 @@ public partial class CommonServices : BaseServices>, ICommon
var index = -1;
switch (param.menuName)
{
- case "F_SurveyQuestionPool":
case "F_Training_CourseAndScene_Report":
+ {
+ toolbar = result.JM_PageControlT1.Toolbar.Where(x => x.fnKey == "NewYN").FirstOrDefault();
+ if (toolbar != null) { toolbar.fnKey = "TBD1YN"; }
+ toolbar = result.JM_PageControlT1.Toolbar.Where(x => x.fnKey == "UpdateYN").FirstOrDefault();
+ if (toolbar != null) { toolbar.fnKey = "TBD2YN"; }
+ toolbar = result.JM_PageControlT1.Toolbar.Where(x => x.fnKey == "DetailYN").FirstOrDefault();
+ if (toolbar != null) { toolbar.fnKey = "TBD3YN"; toolbar.fnTitle = "分析"; }
+ toolbar = result.JM_PageControlT1.Toolbar.Where(x => x.fnKey == "CopyYN").FirstOrDefault();
+ if (toolbar != null) { toolbar.fnKey = "TBD4YN"; }
+ break;
+ }
+ case "F_SurveyQuestionPool":
case "F_QuestionBank":
toolbar = result.JM_PageControlT1.Toolbar.Where(x => x.fnKey == "NewYN").FirstOrDefault();
if (toolbar != null) { toolbar.fnKey = "TBD1YN"; }
diff --git a/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs b/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs
index 997e86a9..4b2a4dc5 100644
--- a/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs
+++ b/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs
@@ -1,4 +1,5 @@
using NPOI.SS.UserModel;
+using System.Net;
using static Tiobon.Core.Model.Consts;
namespace Tiobon.Core.Services;
@@ -1408,6 +1409,57 @@ public class Ghre_CourseServices : BaseServices(sql1);
+ for (int i = 0; i < data.Count; i++)
+ {
+ data[i].RequiredCount = await Db.Queryable()
+ .Where(x => (x.CourseSceneId == data[i].Id || x.CourseId == data[i].Id) && x.OpenClassId == null && x.CourseType.Contains("Required"))
+ .CountAsync();
+
+ data[i].ElectiveCount = await Db.Queryable()
+ .Where(x => (x.CourseSceneId == data[i].Id || x.CourseId == data[i].Id) && x.OpenClassId == null && x.CourseType.Contains("Elective"))
+ .CountAsync();
+
+
+ data[i].OpenClassCount = await Db.Queryable()
+ .Where(x => (x.CourseSceneId == data[i].Id || x.CourseId == data[i].Id) && x.OpenClassId != null)
+ .CountAsync();
+
+ data[i].CompleteCount = await Db.Queryable()
+ .Where(x => (x.CourseSceneId == data[i].Id || x.CourseId == data[i].Id) && x.CompleteStatus == DIC_STUDY_RECORD_STUDY_COMPLETE_STATUS.FINISHED)
+ .CountAsync();
+
+ var studyRecordIds = await Db.Queryable()
+ .Where(x => x.CourseSceneId == data[i].Id || x.CourseId == data[i].Id)
+ .Select(x => x.Id)
+ .ToListAsync();
+
+ data[i].TotalStudyDuration = await Db.Queryable()
+ .Where(x => x.StudyRecordId != null && studyRecordIds.Contains(x.StudyRecordId.Value))
+ .SumAsync(x => x.StudyDuration);
+ data[i].TotalStudyDuration = data[i].TotalStudyDuration ?? 0;
+ if (data[i].TotalStudyDuration > 0)
+ {
+ var avgStudyDuration = data[i].TotalStudyDuration / (studyRecordIds.Count);
+
+ data[i].AvgStudyDuration = avgStudyDuration.TrimDecimalString(2);
+ }
+
+ data[i].AvgScore = await Db.Queryable()
+ .Where(x => x.StudyRecordId != null && studyRecordIds.Contains(x.StudyRecordId.Value))
+ .AvgAsync(x => x.Score);
+
+ data[i].AvgScore = data[i].AvgScore ?? 0;
+
+ var examCount = await Db.Queryable()
+ .Where(x => x.StudyRecordId != null && studyRecordIds.Contains(x.StudyRecordId.Value))
+ .CountAsync();
+ var passCount = await Db.Queryable()
+ .Where(x => x.StudyRecordId != null && studyRecordIds.Contains(x.StudyRecordId.Value) && x.IsPass == true)
+ .CountAsync();
+ if (passCount > 0 && examCount > 0)
+ data[i].PassPercent = passCount / examCount;
+ }
+
totalCount = await Db.Ado.GetIntAsync("SELECT COUNT(0) from Ghre_CourseScene_V A WHERE 1=1");
@@ -1615,6 +1667,7 @@ public class Ghre_CourseServices : BaseServices x.QuestionId == questionErrorRankings[i].Id).Count();
questionErrorRankings[i].ErrorCount = recordDetails.Where(x => x.QuestionId == questionErrorRankings[i].Id && x.IsCorrect != true).Count();
diff --git a/Tiobon.Core/Tiobon.Core.Model.xml b/Tiobon.Core/Tiobon.Core.Model.xml
index 66975c7f..7d5b30aa 100644
--- a/Tiobon.Core/Tiobon.Core.Model.xml
+++ b/Tiobon.Core/Tiobon.Core.Model.xml
@@ -41045,7 +41045,7 @@
- 培训记录-学习状态
+ 培训记录-完成状态