时长
This commit is contained in:
parent
b2ee87d2d2
commit
02b7b0ba9a
@ -1144,10 +1144,11 @@ namespace YD_YiLu.Api.Services.Impl
|
||||
.Select(day =>
|
||||
{
|
||||
var dayTrains = trains.Where(x => x.StartTime.Date == day).ToList();
|
||||
var daySeconds = dayTrains.Sum(x => x.Duration);
|
||||
return new YtpGradeListItem
|
||||
{
|
||||
Time = day.ToString("yyyy-MM-dd"),
|
||||
Duration = dayTrains.Sum(x => x.Duration).ToString(),
|
||||
Duration = SecondsToHours(daySeconds),
|
||||
Count = dayTrains.Count.ToString()
|
||||
};
|
||||
})
|
||||
@ -1159,10 +1160,10 @@ namespace YD_YiLu.Api.Services.Impl
|
||||
{
|
||||
CourseId = g.Key,
|
||||
CourseName = Util.GetEnumDescription<CourseType>(g.Key),
|
||||
Time = g.Sum(x => x.Duration).ToString(),
|
||||
Time = SecondsToHours(g.Sum(x => x.Duration)),
|
||||
Count = g.Count()
|
||||
})
|
||||
.OrderByDescending(x => int.TryParse(x.Time, out var seconds) ? seconds : 0)
|
||||
.OrderByDescending(x => double.TryParse(x.Time, out var hours) ? hours : 0)
|
||||
.ToList();
|
||||
|
||||
return result;
|
||||
@ -1406,6 +1407,11 @@ namespace YD_YiLu.Api.Services.Impl
|
||||
return "AUTO-" + MD5Helper.MD5Encrypt32(value);
|
||||
}
|
||||
|
||||
private static string SecondsToHours(int seconds)
|
||||
{
|
||||
return (seconds / 3600.0).ToString("0.00");
|
||||
}
|
||||
|
||||
private static (DateTime? start, DateTime? end) GetDateRange(int dateType, string queryStart, string queryEnd)
|
||||
{
|
||||
var today = DateTime.Now.Date;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user