|
@@ -46,37 +46,33 @@ namespace TEAMModelOS.SDK
|
|
|
{
|
|
|
se = period.semesters.First();
|
|
|
}
|
|
|
+ string sm = "09";
|
|
|
+ string sd = "01";
|
|
|
if (se != null)
|
|
|
{
|
|
|
- string sm = se.month >= 10 ? $"{se.month}" : $"0{se.month}";
|
|
|
- string sd = se.day >= 10 ? $"{se.day}" : $"0{se.day}";
|
|
|
+ sm = se.month >= 10 ? $"{se.month}" : $"0{se.month}";
|
|
|
+ sd = se.day >= 10 ? $"{se.day}" : $"0{se.day}";
|
|
|
start = int.Parse($"{Year}{sm}{sd}");
|
|
|
}
|
|
|
int curr = int.Parse(date.ToString("yyyyMMdd"));
|
|
|
//新学年开学时间大于当前时间,计算年级需要减1 20220901-20220408 > 0 则当前20220408是2021年入学的,
|
|
|
//当前时间大于新学年开学时间,计算年级则不需要 20220901-20221203 < 1 则当前20221203是2022年入学的,
|
|
|
- //20230901-20230101 > 0 则当前20230101是2022年入学的,
|
|
|
+ //20230901-20230101 > 0 则当前20230101是2022年入学的,
|
|
|
int dis = start - curr;
|
|
|
foreach (int year in years)
|
|
|
{
|
|
|
- int grade;
|
|
|
- if (dis > 0)
|
|
|
- {
|
|
|
- if (Year - year > 0)
|
|
|
+ if (int.Parse($"{year}{sm}{sd}") < curr) {
|
|
|
+ int grade;
|
|
|
+ if (dis > 0)
|
|
|
{
|
|
|
- grade = (Year - year - 1) % Count.Value;
|
|
|
+ grade = Math.Abs((Year - year - 1)) % Count.Value;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
grade = Math.Abs((Year - year)) % Count.Value;
|
|
|
}
|
|
|
-
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- grade = Math.Abs((Year - year)) % Count.Value;
|
|
|
+ yearGrades.Add(new KeyValuePair<int, string>(year, $"{grade}"));
|
|
|
}
|
|
|
- yearGrades.Add(new KeyValuePair<int, string>(year,$"{grade}"));
|
|
|
}
|
|
|
}
|
|
|
return yearGrades;
|