Skip to content

Instantly share code, notes, and snippets.

@MichaelStett
Last active October 27, 2020 09:58
Show Gist options
  • Save MichaelStett/ba431d79ffc6846918b1917b374dfb0d to your computer and use it in GitHub Desktop.
Save MichaelStett/ba431d79ffc6846918b1917b374dfb0d to your computer and use it in GitHub Desktop.
Program-3.cs
// 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