update:学生端课堂报告&体测报告优化

This commit is contained in:
ltx 2026-07-31 11:59:37 +08:00
parent 0019004465
commit b8d9670953
2 changed files with 14 additions and 13 deletions

View File

@ -186,7 +186,10 @@ namespace YD_WeChatApplet.Api.Services.Impl
/// <returns></returns>
public async Task<StudentReportDto> StudentReport(string? studentNo)
{
var res = new StudentReportDto();
var res = new StudentReportDto
{
CategoryScoreList = new List<CategoryScoreDto>()
};
// 若参数为空,则尝试从登录上下文获取当前用户编号
if (string.IsNullOrWhiteSpace(studentNo))
@ -272,8 +275,6 @@ namespace YD_WeChatApplet.Api.Services.Impl
ScoreTime = x.ScoreTime
}).ToListAsync();
res.CategoryScoreList = new List<CategoryScoreDto>();
foreach (var item in categorys)
{
// ✅ 当前学生数据
@ -327,11 +328,11 @@ namespace YD_WeChatApplet.Api.Services.Impl
res.CategoryScoreList.Add(new CategoryScoreDto()
{
CategoryValue = item.CategoryValue,
CategoryValue = item.Id,
Name = item.CategoryName,
Rank = lastResult?.Rank,
GradeId = lastResult.GradeId,
GradeId = lastResult?.GradeId,
PrevScore = prevResult?.Score ?? 0,
LastScore = lastResult?.Score ?? 0,
@ -340,7 +341,7 @@ namespace YD_WeChatApplet.Api.Services.Impl
//ClassAvgScore = (float)classAvgScore,
SchoolAvgScore = (float)schoolAvgScore,
ScoreTrendChart = trendChart,
ScoreTrendChart = trendChart ?? new ScoreTrendChartDataDto { AxisX = new List<string>(), AxisY = new List<float>() },
ImgUrl = $"{AppSettings.ALiYunOSS.CategoryImgUrl}{item.CategoryEnum}.png"
});

View File

@ -14,7 +14,7 @@ namespace YD_WeChatApplet.Commons.Dto.Patriarch
/// <summary>
/// 各项目得分
/// </summary>
public List<CategoryScoreDto> CategoryScoreList { get; set; }
public List<CategoryScoreDto> CategoryScoreList { get; set; } = new List<CategoryScoreDto>();
}
/// <summary>
@ -30,7 +30,7 @@ namespace YD_WeChatApplet.Commons.Dto.Patriarch
/// <summary>
/// 项目名称
/// </summary>
public string Name { get; set; }
public string Name { get; set; } = string.Empty;
/// <summary>
/// 上一次得分
@ -60,12 +60,12 @@ namespace YD_WeChatApplet.Commons.Dto.Patriarch
/// <summary>
/// 图片地址
/// </summary>
public string ImgUrl { get; set; }
public string ImgUrl { get; set; } = string.Empty;
/// <summary>
/// 等级
/// </summary>
public string Rank { get; set; }
public string Rank { get; set; } = string.Empty;
/// <summary>
///年级Id
@ -75,7 +75,7 @@ namespace YD_WeChatApplet.Commons.Dto.Patriarch
/// <summary>
/// 成绩趋势图
/// </summary>
public ScoreTrendChartDataDto ScoreTrendChart { get; set; }
public ScoreTrendChartDataDto ScoreTrendChart { get; set; } = new ScoreTrendChartDataDto();
}
public class ScoreTrendChartDataDto
@ -83,11 +83,11 @@ namespace YD_WeChatApplet.Commons.Dto.Patriarch
/// <summary>
/// X轴
/// </summary>
public List<string> AxisX { get; set; }
public List<string> AxisX { get; set; } = new List<string>();
/// <summary>
/// Y轴
/// </summary>
public List<float> AxisY { get; set; }
public List<float> AxisY { get; set; } = new List<float>();
}
}