Skip to content

Commit

Permalink
Better service alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronClaydon committed Oct 20, 2023
1 parent 869d482 commit e0737e9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
15 changes: 9 additions & 6 deletions pkg/ctdf/servicealert.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,15 @@ type ServiceAlert struct {
type ServiceAlertType string

const (
ServiceAlertTypeInformation ServiceAlertType = "Information"
ServiceAlertTypeWarning = "Warning"
ServiceAlertTypeStopClosed = "StopClosed"
ServiceAlertTypeServiceSuspended = "ServiceSuspended"
ServiceAlertTypeDisruption = "Disruption"
ServiceAlertTypePlanned = "Planned"
ServiceAlertTypeInformation ServiceAlertType = "Information"
ServiceAlertTypeWarning = "Warning"
ServiceAlertTypeStopClosed = "StopClosed"
ServiceAlertTypeServiceSuspended = "ServiceSuspended"
ServiceAlertTypeServicePartSuspended = "ServicePartSuspended"
ServiceAlertTypeSeverDelays = "SeverDelays"
ServiceAlertTypeDelays = "Delays"
ServiceAlertTypeMinorDelays = "MinorDelays"
ServiceAlertTypePlanned = "Planned"
)

func (a *ServiceAlert) IsValid(checkTime time.Time) bool {
Expand Down
12 changes: 9 additions & 3 deletions pkg/realtime/tflarrivals/modedisruptiontracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,10 +253,16 @@ func (d *ModeDisruptionTracker) GetLineStatuses() {
var serviceAlertType ctdf.ServiceAlertType

switch lineStatusUpdate.StatusSeverityDescription {
case "Closed", "Suspended", "Part Suspended", "Part Closure", "Planned Closure", "Part Closed", "Service Closed":
case "Closed", "Suspended", "Planned Closure", "Service Closed":
serviceAlertType = ctdf.ServiceAlertTypeServiceSuspended
case "Severe Delays", "Reduced Service", "Minor Delays":
serviceAlertType = ctdf.ServiceAlertTypeDisruption
case "Part Suspended", "Part Closure", "Part Closed":
serviceAlertType = ctdf.ServiceAlertTypeServicePartSuspended
case "Severe Delays":
serviceAlertType = ctdf.ServiceAlertTypeSeverDelays
case "Reduced Service":
serviceAlertType = ctdf.ServiceAlertTypeDelays
case "Minor Delays":
serviceAlertType = ctdf.ServiceAlertTypeMinorDelays
case "Bus Service", "Exit Only", "Change of frequency", "Diverted", "Not Running", "Issues Reported":
serviceAlertType = ctdf.ServiceAlertTypeWarning
case "No Step Free Access", "Information":
Expand Down

0 comments on commit e0737e9

Please sign in to comment.