Skip to content

Commit

Permalink
Adjust resdiential status to be bool. updated logic for function
Browse files Browse the repository at this point in the history
  • Loading branch information
RossClark01 committed Dec 11, 2024
1 parent 44c9436 commit a10e9d7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Gordon360/Models/CCT/Housing/ResidentialStatus_View.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ public partial class ResidentialStatus_View
[Unicode(false)]
public string Residency_Status { get; set; }

public int Is_Residential { get; set; }
public bool? Is_Residential { get; set; }
}
4 changes: 2 additions & 2 deletions Gordon360/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"Development": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "https://localhost:51659/swagger",
"launchUrl": "https://localhost:51657/swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sqlDebugging": true,
"applicationUrl": "https://localhost:51659;http://localhost:51660"
"applicationUrl": "https://localhost:51657;http://localhost:51658"
},
"Train": {
"commandName": "Project",
Expand Down
8 changes: 4 additions & 4 deletions Gordon360/Services/HousingService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -550,11 +550,11 @@ public async Task<Hall_Assignment_Ranges> CreateRoomRangeAsync(HallAssignmentRan
}
// Check if there is any overlapping room ranges in the same hall
var overlappingRange = await context.Hall_Assignment_Ranges
.FirstOrDefaultAsync(r => r.Hall_ID == model.Hall_ID
.AnyAsync(r => r.Hall_ID == model.Hall_ID
&& ((r.Room_Start <= model.Room_Start && r.Room_End >= model.Room_Start) ||
(r.Room_Start <= model.Room_End && r.Room_End >= model.Room_End)));

if (overlappingRange != null)
if (overlappingRange)
{
throw new InvalidOperationException("The room range overlaps with an existing range in this hall.");
}
Expand Down Expand Up @@ -1062,12 +1062,12 @@ public async Task<bool> IsRAOnCallAsync(string raId)
/// <returns>True if the student is a resident</returns>
public async Task<bool> IsStudentResidentialAsync(int idNum)
{
var student = await context.ResidentialStatus_View
var isRes = await context.ResidentialStatus_View
.Where(s => s.Student_ID == idNum)
.Select(s => s.Is_Residential)
.FirstOrDefaultAsync();

return student == 1;
return isRes ?? false;
}


Expand Down

0 comments on commit a10e9d7

Please sign in to comment.