Removed unused functions and documented reporting

This commit is contained in:
雲華
2022-04-17 13:19:35 -04:00
parent f6f90c76b2
commit 565997b9d7
5 changed files with 99 additions and 34 deletions

View File

@@ -5,8 +5,23 @@ namespace Ophelias.Reporting
{
internal static class Operational
{
/*
* This class is a collection of operational reporting operations.
* The purpose of it is to write out information regarding the daily
* arrivals and daily occupancy using fstring to print out the reports.
* The output is not fully formatted as there is no way to accurately pad
* the strings. If we knew the longest possible string, which we do not
* because names can be any length, we chose to use tabs for the initial
* spacing.
*/
internal static void FetchDailyArriavals(List<Reservation> reservations)
{
/*
* This class gets writes the daily arrivals in the reservation list.
* If there is a room number that is specified with an individual,
* their room number is listed. Otherwise it is marked as N/A since
* they have not checked in yet to recieve their room.
*/
List<string> entries = new();
foreach (Reservation r in reservations)
{
@@ -25,15 +40,25 @@ namespace Ophelias.Reporting
}
string report = $"DAILY ARRIVAL REPORT - GENERATED ON {DateTime.Now.Date.ToString("yyyy-MM-dd")}\n" +
$"Last, First\tType\tRoom\tDeparture\n" +
$"{string.Join("\n", entries)}\n\n";
$"{string.Join("\n", entries)}\n\n"; // Format the list joined into the string
File.AppendAllText(Path.GetFullPath("DailyArrivals.txt"), report);
File.AppendAllText(Path.GetFullPath("DailyArrivals.txt"), report); // Write to file
}
internal static void FetchDailyOccupancy(List<(DateTime, int, string, string)> cop, List<int> pop)
{
/*
* Fetch Daily Occupancy gets the occupancy for that day. If the guest is leaving
* the same day, an * will preceed their name. If the room they are in was occupied
* the day before, a last occupied date is included.
*/
List<string> entries = new();
foreach (var c in cop)
{
/*
* Iterates over each item to determine whether a date and *
* needs to be set based on the conditions detailed in the
* docstring.
*/
string lastOccupied;
string sameDayLeave = "";
if (pop.Contains(c.Item2))
@@ -53,9 +78,9 @@ namespace Ophelias.Reporting
string report = $"DAILY OCCUPANCY REPORT - GENERATED ON {DateTime.Now.Date.ToString("yyyy-MM-dd")}\n" +
$"An * means that the guest is leaving the same day.\n" +
$"Room #\tPrev. Occupied\tCurrent Occupant\n" +
$"{string.Join("\n", entries)}\n\n";
$"{string.Join("\n", entries)}\n\n"; // Format the list joined into the string
File.AppendAllText(Path.GetFullPath("DailyOccupancy.txt"), report);
File.AppendAllText(Path.GetFullPath("DailyOccupancy.txt"), report); // Write to file
}
}