Skip to content

Commit

Permalink
replaced static accepted firs with regex gh-18
Browse files Browse the repository at this point in the history
  • Loading branch information
bjerrecs committed Aug 10, 2024
1 parent 1ed1414 commit f932ed7
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/components/BookingComponentv3.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@ import {

import "../globals.css";

function isBookingAlive(start, end) {
const currentDate = new Date();
const startDate = new Date(start);
const endDate = new Date(end);

return startDate <= currentDate && endDate
}

const BookingComponent = () => {
const [SessionToday, setSessionToday] = useState([]);
const [BookingsToday, setBookingsToday] = useState([]);
Expand All @@ -42,10 +34,11 @@ const BookingComponent = () => {

var filterdSessions = [];

const acceptedFIRs = ["EK", "EN", "EF", "ES", "BI", "BG"];
const acceptedFIRsRegex = /((EK[A-Z][A-Z]_)|(EF[A-Z][A-Z]_)|(BI[A-Z][A-Z]_)|(EN[A-Z][A-Z]_)|(ES[A-Z][A-Z]_))\w+/i;

for (const session of NetworkApiData.controllers) {
if (acceptedFIRs.includes(session.callsign.slice(0, 2)) && session.facility > 0) {
const callsign = session.callsign;
if (acceptedFIRsRegex.test(callsign) && session.facility > 0) {
filterdSessions = [...filterdSessions, session];
}
}
Expand Down

0 comments on commit f932ed7

Please sign in to comment.