|
@@ -416,6 +416,7 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
|
//5. 決賽課程生成
|
|
|
///生成資料製作
|
|
|
List<JointEventGroupDb> jointCourseCreates = new List<JointEventGroupDb>(); //要生成的老師課程名單
|
|
|
+ Dictionary<string, int> jointGroupClassCntDic = new Dictionary<string, int>(); //各jointGroup的班級數目 => 用來做個決賽班級的流水號
|
|
|
foreach (JointEventGroupDb jointEventCourseRow in jointEventCourse)
|
|
|
{
|
|
|
foreach (JointEventGroupBase.JointEventGroupCourse course in jointEventCourseRow.courseLists)
|
|
@@ -430,6 +431,10 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
|
JointEventGroupDb jointCourseCreateRow = jointCourseCreates.Where(c => c.jointEventId.Equals(jointEventCourseRow.jointEventId) && c.jointGroupId.Equals(jointEventCourseRow.jointGroupId) && c.creatorId.Equals(jointEventCourseRow.creatorId)).FirstOrDefault();
|
|
|
if (jointCourseCreateRow == null)
|
|
|
{
|
|
|
+ ///各jointGroup的班級數目計算
|
|
|
+ if (jointGroupClassCntDic.ContainsKey(jointEventCourseRow.jointGroupId)) jointGroupClassCntDic[jointEventCourseRow.jointGroupId]++;
|
|
|
+ else jointGroupClassCntDic.Add(jointEventCourseRow.jointGroupId, 1);
|
|
|
+ ///DB 老師決賽document
|
|
|
JointEventGroupDb finalEventCourse = new JointEventGroupDb();
|
|
|
finalEventCourse.jointEventId = jointEventCourseRow.jointEventId;
|
|
|
finalEventCourse.jointGroupId = jointEventCourseRow.jointGroupId;
|
|
@@ -448,7 +453,7 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
|
courseId = courseId,
|
|
|
courseName = courseName,
|
|
|
groupLists = new List<JointEventGroupBase.JointEventGroupCourseGroup>() {
|
|
|
- new() { id = group.id, name = group.name }
|
|
|
+ new() { id = group.id, name = group.name, no = jointGroupClassCntDic[jointEventCourseRow.jointGroupId].ToString() }
|
|
|
}
|
|
|
});
|
|
|
finalEventCourse.createTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
|
@@ -459,13 +464,17 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
|
JointEventGroupBase.JointEventGroupCourse courseRowNow = jointCourseCreateRow.courseLists.Where(c => c.courseId.Equals(courseId)).FirstOrDefault();
|
|
|
if (courseRowNow == null)
|
|
|
{
|
|
|
+ ///各jointGroup的班級數目計算
|
|
|
+ if (jointGroupClassCntDic.ContainsKey(jointEventCourseRow.jointGroupId)) jointGroupClassCntDic[jointEventCourseRow.jointGroupId]++;
|
|
|
+ else jointGroupClassCntDic.Add(jointEventCourseRow.jointGroupId, 1);
|
|
|
+ ///DB 老師決賽課程資料
|
|
|
jointCourseCreateRow.courseLists.Add(
|
|
|
new JointEventGroupBase.JointEventGroupCourse
|
|
|
{
|
|
|
courseId = courseId,
|
|
|
courseName = courseName,
|
|
|
groupLists = new List<JointEventGroupBase.JointEventGroupCourseGroup>() {
|
|
|
- new() { id = group.id, name = group.name }
|
|
|
+ new() { id = group.id, name = group.name, no = jointGroupClassCntDic[jointEventCourseRow.jointGroupId].ToString() }
|
|
|
}
|
|
|
}
|
|
|
);
|
|
@@ -475,8 +484,12 @@ namespace TEAMModelOS.SDK.Models.Service
|
|
|
JointEventGroupBase.JointEventGroupCourseGroup groupRowNow = courseRowNow.groupLists.Where(g => g.id.Equals(group.id)).FirstOrDefault();
|
|
|
if (groupRowNow == null)
|
|
|
{
|
|
|
+ ///各jointGroup的班級數目計算
|
|
|
+ if (jointGroupClassCntDic.ContainsKey(jointEventCourseRow.jointGroupId)) jointGroupClassCntDic[jointEventCourseRow.jointGroupId]++;
|
|
|
+ else jointGroupClassCntDic.Add(jointEventCourseRow.jointGroupId, 1);
|
|
|
+ ///DB 老師決賽班級資料
|
|
|
courseRowNow.groupLists.Add(
|
|
|
- new() { id = group.id, name = group.name }
|
|
|
+ new() { id = group.id, name = group.name, no = jointGroupClassCntDic[jointEventCourseRow.jointGroupId].ToString() }
|
|
|
);
|
|
|
}
|
|
|
}
|