Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/retired-booking-writes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# MBA-3824: the .NET booking/capacity slice and booking-api write SQL are retired (docs/adr/0004).
name: retired booking writes guard

on:
pull_request:
paths:
- 'AssessmentDelivery.*/**'
- 'services/booking-api/**'
- 'scripts/check-retired-booking-writes.sh'
- '.github/workflows/retired-booking-writes.yml'
push:
branches: [estate/legacy-baseline]

jobs:
grep:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: no booking writes, SeatsAvailable updates or retired procs
run: bash scripts/check-retired-booking-writes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<Compile Include="Rules\PriorAttempt.cs" />
<Compile Include="Rules\RetakeDecision.cs" />
<Compile Include="Rules\RetakeRules.cs" />
<Compile Include="Rules\SeatCounter.cs" />
<Compile Include="Rules\BookingStatus.cs" />
<Compile Include="Startup\BizLayerInitialise.cs" />
<Compile Include="Startup\BizLayerModule.cs" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion AssessmentDelivery.Business/Roster/RosterCsv.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static class RosterCsv

public static bool IsOnRoster(string bookingStatus)
{
return SeatCounter.HoldsSeat(bookingStatus) || bookingStatus == BookingStatus.Waitlisted;
return bookingStatus == BookingStatus.Booked || bookingStatus == BookingStatus.Attended || bookingStatus == BookingStatus.Waitlisted;
}

public static IList<RosterLine> Order(IEnumerable<RosterLine> lines)
Expand Down
10 changes: 10 additions & 0 deletions AssessmentDelivery.Business/Rules/BookingStatus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
namespace AssessmentDelivery.Business.Rules
{
public static class BookingStatus
{
public const string Booked = "BOOKED";
public const string Cancelled = "CANCELLED";
public const string Waitlisted = "WAITLISTED";
public const string Attended = "ATTENDED";
}
}
2 changes: 1 addition & 1 deletion AssessmentDelivery.Business/Rules/CapacityAuditDetail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace AssessmentDelivery.Business.Rules
{
/// <summary>
/// Parses the AuditLog.Detail written by usp_ChangeCapacity ('&lt;old&gt; -&gt; &lt;new&gt;').
/// Parses the AuditLog.Detail of a capacity change ('&lt;old&gt; -&gt; &lt;new&gt;', legacy capacity proc format).
/// Same format rule as db/procs/030_usp_GetCapacityAudit.sql - keep the two in step.
/// </summary>
public sealed class CapacityAuditDetail
Expand Down
35 changes: 0 additions & 35 deletions AssessmentDelivery.Business/Rules/SeatCounter.cs

This file was deleted.

4 changes: 2 additions & 2 deletions AssessmentDelivery.Data/DataClasses/Entities/ExamSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public class ExamSession
public int AccommodationCapacity { get; set; }

/// <summary>
/// Denormalised counter kept up to date by usp_BookSeat / usp_CancelBooking.
/// Do not update this from the portal directly.
/// Denormalised counter, written only by the scheduling-service relay (docs/adr/0003, 0004).
/// Read-only in the portal.
/// </summary>
public int SeatsAvailable { get; set; }

Expand Down
30 changes: 2 additions & 28 deletions AssessmentDelivery.Services/Admin/AdminService.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Data.SqlClient;
using System.Linq;
using AssessmentDelivery.Business.Roster;
Expand Down Expand Up @@ -65,31 +64,6 @@ public IList<AdminSessionRow> ListSessions(int centerId)
return Load(_db.ExamSessions.Where(s => s.TestCenterId == centerId));
}

public AdminSessionRow GetSessionRow(int sessionId)
{
return Load(_db.ExamSessions.Where(s => s.SessionId == sessionId)).SingleOrDefault();
}

public void ChangeCapacity(int sessionId, int newCapacity, string actor)
{
if (newCapacity < 0)
throw new PortalException("Capacity cannot be negative.");
try
{
_db.Database.ExecuteSqlCommand(TransactionalBehavior.DoNotEnsureTransaction,
"EXEC dbo.usp_ChangeCapacity @SessionId, @NewCapacity, @Actor",
new SqlParameter("@SessionId", sessionId),
new SqlParameter("@NewCapacity", newCapacity),
new SqlParameter("@Actor", SqlDbType.VarChar, 60) { Value = string.IsNullOrEmpty(actor) ? "portal-admin" : actor });
}
catch (Exception ex)
{
var pe = SqlErrorHelper.TryTranslate(ex);
if (pe != null) throw pe;
throw;
}
}

public CapacityAuditResult GetCapacityAudit(int centerId, DateTime from, DateTime toExclusive, int? sessionId, int pageNumber, int pageSize)
{
var rows = QueryCapacityAudit(centerId, from, toExclusive, sessionId, pageNumber, pageSize);
Expand Down Expand Up @@ -210,7 +184,7 @@ private IList<AdminSessionRow> Load(IQueryable<ExamSession> q)
s.AccommodationCapacity,
s.SeatsAvailable,
s.Status,
Statuses = s.Bookings.Select(b => b.Status),
Booked = s.Bookings.Count(b => b.Status == BookingStatus.Booked || b.Status == BookingStatus.Attended),
WaitlistCount = s.Waitlist.Count()
}).ToList();

Expand All @@ -227,7 +201,7 @@ private IList<AdminSessionRow> Load(IQueryable<ExamSession> q)
Capacity = r.Capacity,
AccommodationCapacity = r.AccommodationCapacity,
SeatsAvailable = r.SeatsAvailable,
Booked = SeatCounter.CountBooked(r.Statuses),
Booked = r.Booked,
WaitlistCount = r.WaitlistCount,
Status = r.Status
}).ToList();
Expand Down
2 changes: 0 additions & 2 deletions AssessmentDelivery.Services/Admin/IAdminService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ public interface IAdminService
TestCenter GetCenter(int centerId);
void UpdateCenter(int centerId, string name, bool isActive);
IList<AdminSessionRow> ListSessions(int centerId);
AdminSessionRow GetSessionRow(int sessionId);
void ChangeCapacity(int sessionId, int newCapacity, string actor);

/// <summary>Capacity changes for sessions at a centre via usp_GetCapacityAudit, newest first. Reads only.</summary>
CapacityAuditResult GetCapacityAudit(int centerId, DateTime from, DateTime toExclusive, int? sessionId, int pageNumber, int pageSize);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,7 @@
<Compile Include="Admin\CenterListItem.cs" />
<Compile Include="Admin\IAdminService.cs" />
<Compile Include="Admin\SessionRoster.cs" />
<Compile Include="Booking\BookingListItem.cs" />
<Compile Include="Booking\BookingOutcome.cs" />
<Compile Include="Booking\BookingService.cs" />
<Compile Include="Booking\IBookingService.cs" />
<Compile Include="Booking\SessionListItem.cs" />
<Compile Include="Booking\SessionSearchCriteria.cs" />
<Compile Include="Common\PortalException.cs" />
<Compile Include="Common\SqlErrorHelper.cs" />
<Compile Include="Eligibility\EligibilityService.cs" />
<Compile Include="Eligibility\IEligibilityService.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down
22 changes: 0 additions & 22 deletions AssessmentDelivery.Services/Booking/BookingListItem.cs

This file was deleted.

9 changes: 0 additions & 9 deletions AssessmentDelivery.Services/Booking/BookingOutcome.cs

This file was deleted.

Loading
Loading