Last active
October 27, 2020 09:58
-
-
Save MichaelStett/ba431d79ffc6846918b1917b374dfb0d to your computer and use it in GitHub Desktop.
Program-3.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Reading last attendance file | |
var LastAttendanceRecords = CsvHelperExtension.GetOutputRecords(attendanceFile); | |
var CsvOutputRecords = usersWithMinutes.Select(x => | |
{ | |
var fullName = string.Join(" ", x.Key.Split(' ').Reverse()).Trim(); | |
var lastRecord = LastAttendanceRecords.FirstOrDefault(f => f.FullName == fullName); | |
var count = lastRecord?.AttendanceCount ?? 0; | |
var lastAttendanceLength = lastRecord?.AttendanceLength ?? "0"; | |
LastAttendanceRecords.Remove(lastRecord); | |
return new RecordOutput | |
{ | |
FullName = fullName, | |
AttendanceCount = count + (x.Value > timeForAttendanceToCount ? 1 : 0), | |
AttendanceLength = $"{lastAttendanceLength}, {lectureNumber}: [{x.Value:f2}]" | |
}; | |
}) | |
.ToList(); | |
// Add not present student from last file | |
CsvOutputRecords.AddRange(LastAttendanceRecords); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment