Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Whitelist - gather coordinates for one to many routing #155

Open
wants to merge 35 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
4e43ce0
format
nilspenzel Sep 19, 2024
1dea051
wip
nilspenzel Sep 19, 2024
5976f36
wip
nilspenzel Sep 19, 2024
c8d720f
Merge branch 'master' into gather
nilspenzel Sep 19, 2024
4537cc3
wip
nilspenzel Sep 19, 2024
d326dc5
wip
nilspenzel Sep 20, 2024
55d93bf
wip
nilspenzel Sep 20, 2024
de81c52
wip
nilspenzel Sep 20, 2024
cb2ad94
Remove unsed functions
nilspenzel Sep 20, 2024
d103439
wip
nilspenzel Sep 20, 2024
549f4c0
wip
nilspenzel Sep 24, 2024
1607734
Format
nilspenzel Sep 24, 2024
59f08bf
wip
nilspenzel Sep 27, 2024
b0506dd
wip
nilspenzel Sep 27, 2024
0107310
wip
nilspenzel Sep 27, 2024
3dd888e
wip
nilspenzel Sep 29, 2024
6f77181
wip
nilspenzel Oct 8, 2024
a2e70a1
wip
nilspenzel Oct 8, 2024
ecbfbd9
wip
nilspenzel Oct 8, 2024
92fa21d
wip
nilspenzel Oct 8, 2024
83bd7ba
wip
nilspenzel Oct 8, 2024
acd1862
Rename CheckBookingValidityParameters -> WhiteListRequest
nilspenzel Oct 22, 2024
301e25a
Move busStopCompanyFilter into Company
nilspenzel Oct 22, 2024
c019ab1
Use alias type to clarify that type is used for vehicle ids
nilspenzel Oct 22, 2024
ca74dd8
wip
nilspenzel Oct 25, 2024
0cafb6f
Merge master
nilspenzel Nov 21, 2024
89eac37
Alter order of deleting columns in e2e tests
nilspenzel Nov 21, 2024
d5db993
Merge branch 'master' into gather
nilspenzel Nov 21, 2024
bc44522
wip
nilspenzel Dec 4, 2024
dc9ff45
wip
nilspenzel Dec 4, 2024
cfab605
wip
nilspenzel Dec 4, 2024
ac4a0b4
wip
nilspenzel Dec 4, 2024
7408408
wip
nilspenzel Dec 4, 2024
e50da66
wip
nilspenzel Dec 4, 2024
d262020
wip
nilspenzel Dec 4, 2024
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
4 changes: 2 additions & 2 deletions src/lib/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export enum Direction {
Backward
}

export type oneToManyResult = {
export type OneToManyResult = {
duration: number;
distance: number;
};
Expand All @@ -155,7 +155,7 @@ export const oneToMany = async (
one: Coordinates,
many: Coordinates[],
direction: Direction
): Promise<oneToManyResult[]> => {
): Promise<OneToManyResult[]> => {
const dir = direction == Direction.Forward ? 'Forward' : 'Backward';
const response = await fetch('https://europe.motis-project.de/', {
headers: {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/bookingApiParameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { BusStop } from './busStop';
import type { Capacities } from './capacities';
import type { Coordinates } from './location';

export type BookingRequestParameters = {
export type CheckBookingValidityParameters = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export type CheckBookingValidityParameters = {
export type WhiteListRequest = {

Man kann dann BlackListRequest als Alias von Whitelist Request definieren.

Terminologie für Anfragen = ...Request
Terminologie für Antworten = ...Response (ggf. hier wieder Typalias BlacklistResponse = WhitelistResponse falls zutreffend

userChosen: Coordinates;
busStops: BusStop[];
startFixed: boolean;
Expand Down
22 changes: 22 additions & 0 deletions src/lib/compositionTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@ import type { Capacities } from './capacities';
import type { Interval } from './interval';
import type { Coordinates } from './location';

export type Company = {
id: number;
coordinates: Coordinates;
vehicles: Vehicle[];
zoneId: number;
};

export type Vehicle = {
id: number;
capacities: Capacities;
tours: Tour[];
events: Event[];
availabilities: Interval[];
lastEventBefore: Event | undefined;
firstEventAfter: Event | undefined;
};

export type Tour = {
arrival: Date;
departure: Date;
};

export type Event = {
capacities: Capacities;
is_pickup: boolean;
Expand Down
48 changes: 24 additions & 24 deletions src/routes/api/blacklisting/blacklisting.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { BookingRequestParameters } from '$lib/bookingApiParameters';
import type { CheckBookingValidityParameters } from '$lib/bookingApiParameters';
import { Coordinates } from '$lib/location';
import { describe, it, expect, beforeEach } from 'vitest';
import { getViableBusStops } from './viableBusStops';
Expand Down Expand Up @@ -41,7 +41,7 @@ describe('blacklisting test', () => {
await setAvailability(taxi, dateInXMinutes(0), dateInXMinutes(90));
await setTour(taxi, dateInXMinutes(0), dateInXMinutes(90));

const r: BookingRequestParameters = {
const r: CheckBookingValidityParameters = {
userChosen: inNiesky,
busStops: [{ times: [dateInXMinutes(50)], coordinates: inNiesky }],
startFixed: true,
Expand All @@ -58,7 +58,7 @@ describe('blacklisting test', () => {

await setAvailability(taxi, dateInXMinutes(0), dateInXMinutes(90));

const r: BookingRequestParameters = {
const r: CheckBookingValidityParameters = {
userChosen: inNiesky,
busStops: [{ times: [dateInXMinutes(50)], coordinates: inNiesky }],
startFixed: true,
Expand All @@ -75,7 +75,7 @@ describe('blacklisting test', () => {

await setTour(taxi, dateInXMinutes(0), dateInXMinutes(90));

const r: BookingRequestParameters = {
const r: CheckBookingValidityParameters = {
userChosen: inNiesky,
busStops: [{ times: [dateInXMinutes(50)], coordinates: inNiesky }],
startFixed: true,
Expand All @@ -91,7 +91,7 @@ describe('blacklisting test', () => {
const taxi = await addTaxi(company, capacities);
await setTour(taxi, dateInXMinutes(0), dateInXMinutes(900));

const r: BookingRequestParameters = {
const r: CheckBookingValidityParameters = {
userChosen: inNiesky,
busStops: [
{ times: [dateInXMinutes(50), dateInXMinutes(10)], coordinates: inNiesky },
Expand All @@ -110,7 +110,7 @@ describe('blacklisting test', () => {
const taxi = await addTaxi(company, capacities);
await setTour(taxi, dateInXMinutes(0), dateInXMinutes(900));

const r: BookingRequestParameters = {
const r: CheckBookingValidityParameters = {
userChosen: inNiesky,
busStops: [{ times: [dateInXMinutes(50)], coordinates: inNiesky }],
startFixed: true,
Expand All @@ -126,7 +126,7 @@ describe('blacklisting test', () => {
const taxi = await addTaxi(company, capacities);
await setTour(taxi, dateInXMinutes(0), dateInXMinutes(900));

const r: BookingRequestParameters = {
const r: CheckBookingValidityParameters = {
userChosen: inNiesky,
busStops: [{ times: [dateInXMinutes(50)], coordinates: inZittau }],
startFixed: true,
Expand All @@ -142,7 +142,7 @@ describe('blacklisting test', () => {
const taxi = await addTaxi(company, capacities);
await setTour(taxi, dateInXMinutes(0), dateInXMinutes(900));

const r: BookingRequestParameters = {
const r: CheckBookingValidityParameters = {
userChosen: inZittau,
busStops: [{ times: [dateInXMinutes(50)], coordinates: inNiesky }],
startFixed: true,
Expand All @@ -158,7 +158,7 @@ describe('blacklisting test', () => {
const taxi = await addTaxi(company, capacities);
await setTour(taxi, dateInXMinutes(0), dateInXMinutes(900));

const r: BookingRequestParameters = {
const r: CheckBookingValidityParameters = {
userChosen: inNiesky,
busStops: [{ times: [dateInXMinutes(50)], coordinates: inNiesky }],
startFixed: true,
Expand All @@ -174,7 +174,7 @@ describe('blacklisting test', () => {
const taxi = await addTaxi(company, capacities);
await setTour(taxi, dateInXMinutes(0), dateInXMinutes(900));

const r: BookingRequestParameters = {
const r: CheckBookingValidityParameters = {
userChosen: inNiesky,
busStops: [{ times: [dateInXMinutes(50)], coordinates: inNiesky }],
startFixed: true,
Expand All @@ -190,7 +190,7 @@ describe('blacklisting test', () => {
const taxi = await addTaxi(company, capacities);
await setTour(taxi, dateInXMinutes(0), dateInXMinutes(900));

const r: BookingRequestParameters = {
const r: CheckBookingValidityParameters = {
userChosen: inNiesky,
busStops: [{ times: [dateInXMinutes(50)], coordinates: inNiesky }],
startFixed: true,
Expand All @@ -206,7 +206,7 @@ describe('blacklisting test', () => {
const taxi = await addTaxi(company, capacities);
await setTour(taxi, dateInXMinutes(0), dateInXMinutes(900));

const r: BookingRequestParameters = {
const r: CheckBookingValidityParameters = {
userChosen: inNiesky,
busStops: [{ times: [dateInXMinutes(50)], coordinates: inNiesky }],
startFixed: true,
Expand All @@ -219,7 +219,7 @@ describe('blacklisting test', () => {
it('blacklisting fail, no vehicle', async () => {
await addCompany(Zone.NIESKY);

const r: BookingRequestParameters = {
const r: CheckBookingValidityParameters = {
userChosen: inNiesky,
busStops: [{ times: [dateInXMinutes(50)], coordinates: inNiesky }],
startFixed: true,
Expand All @@ -230,7 +230,7 @@ describe('blacklisting test', () => {
});

it('blacklisting fail, no company', async () => {
const r: BookingRequestParameters = {
const r: CheckBookingValidityParameters = {
userChosen: inNiesky,
busStops: [{ times: [dateInXMinutes(50)], coordinates: inNiesky }],
startFixed: true,
Expand All @@ -244,7 +244,7 @@ describe('blacklisting test', () => {
const capacities: Capacities = { passengers: 3, bikes: 3, wheelchairs: 3, luggage: 3 };
const company = await addCompany(Zone.NIESKY);
await addTaxi(company, capacities);
const r: BookingRequestParameters = {
const r: CheckBookingValidityParameters = {
userChosen: inNiesky,
busStops: [{ times: [dateInXMinutes(50)], coordinates: inNiesky }],
startFixed: true,
Expand All @@ -260,7 +260,7 @@ describe('blacklisting test', () => {
const taxi = await addTaxi(company, capacities);
await setTour(taxi, dateInXMinutes(0), dateInXMinutes(900));

const r: BookingRequestParameters = {
const r: CheckBookingValidityParameters = {
userChosen: inNiesky,
busStops: [
{ times: [dateInXMinutes(50)], coordinates: inZittau },
Expand All @@ -281,7 +281,7 @@ describe('blacklisting test', () => {
const taxi = await addTaxi(company, capacities);
await setTour(taxi, dateInXMinutes(0), dateInXMinutes(900));

const r: BookingRequestParameters = {
const r: CheckBookingValidityParameters = {
userChosen: inNiesky,
busStops: [{ times: [dateInXMinutes(1000), dateInXMinutes(50)], coordinates: inNiesky }],
startFixed: true,
Expand All @@ -294,7 +294,7 @@ describe('blacklisting test', () => {
});

it('blacklisting, no busStops', async () => {
const r: BookingRequestParameters = {
const r: CheckBookingValidityParameters = {
userChosen: inNiesky,
busStops: [],
startFixed: true,
Expand All @@ -309,7 +309,7 @@ describe('blacklisting test', () => {
const company = await addCompany(Zone.NIESKY);
const taxi = await addTaxi(company, capacities);
await setTour(taxi, dateInXMinutes(0), dateInXMinutes(900));
const r: BookingRequestParameters = {
const r: CheckBookingValidityParameters = {
userChosen: inNiesky,
busStops: [
{ times: [], coordinates: inNiesky },
Expand All @@ -329,7 +329,7 @@ describe('blacklisting test', () => {
const company = await addCompany(Zone.NIESKY);
const taxi = await addTaxi(company, capacities);
await setTour(taxi, dateInXMinutes(0), dateInXMinutes(900));
const r: BookingRequestParameters = {
const r: CheckBookingValidityParameters = {
userChosen: inNiesky,
busStops: [{ times: [], coordinates: inNiesky }],
startFixed: true,
Expand All @@ -346,7 +346,7 @@ describe('blacklisting test', () => {

await setAvailability(taxi, dateInXMinutes(0), dateInXMinutes(90));

const r: BookingRequestParameters = {
const r: CheckBookingValidityParameters = {
userChosen: inNiesky,
busStops: [
{
Expand All @@ -368,7 +368,7 @@ describe('blacklisting test', () => {

await setAvailability(taxi, dateInXMinutes(0), dateInXMinutes(90));

const r: BookingRequestParameters = {
const r: CheckBookingValidityParameters = {
userChosen: inNiesky,
busStops: [
{
Expand All @@ -390,7 +390,7 @@ describe('blacklisting test', () => {

await setAvailability(taxi, dateInXMinutes(0), dateInXMinutes(90));

const r: BookingRequestParameters = {
const r: CheckBookingValidityParameters = {
userChosen: inNiesky,
busStops: [
{ times: [dateInXMinutesYMs(0, -MAX_PASSENGER_WAITING_TIME_PICKUP)], coordinates: inNiesky }
Expand All @@ -409,7 +409,7 @@ describe('blacklisting test', () => {

await setAvailability(taxi, dateInXMinutes(0), dateInXMinutes(90));

const r: BookingRequestParameters = {
const r: CheckBookingValidityParameters = {
userChosen: inNiesky,
busStops: [
{
Expand Down
Loading