Giter VIP home page Giter VIP logo

aau-p1-software's Introduction

Oh, greetings, fellow humans!

My philosophy on life: You can learn anything you want and thus become anyone you want

  • Based in Copenhagen, Denmark ๐Ÿ“
  • Working at twoday ๐Ÿ’ผ
  • Adobe Certified Professional - Adobe Commerce Developer ๐Ÿ“š
  • Experience with PHP (Adobe Commerce/Magento 2), HTML, CSS (Less, Sass), SQL, JavaScript/TypeScript/Node.js (React), Git/GitHub/Bitbucket โ˜๏ธ
  • Having a special keenness for clean and efficient code ๐ŸคŒ

Wanna know more about me? You can write me in Danish, English, German, Croatian and Russian

Adobe Certified Professional - Adobe Commerce Developer

aau-p1-software's People

Contributors

audio-engineer avatar danar435 avatar madsheilmann avatar sebastianmygind avatar texwo avatar

Watchers

 avatar

aau-p1-software's Issues

Missing `preferences.json` causes evaluation output to fail

Bug report

Info

Version commit: f440721
CMAKE_BUILD_TYPE: Debug

Description

When using the software for the first time (no preferences.json file present yet), choosing not to save the manually entered preferences and reaching the evaluation part, a Error opening user preferences file: No such file or directory is emitted.

WELCOME TO THE PERSONALIZED INTERACTIVE
   __________  __  _____  _____  _____________   ________   ________    ____
  / ____/ __ \/  |/  /  |/  / / / /_  __/  _/ | / / ____/  / ____/ /   /  _/
 / /   / / / / /|_/ / /|_/ / / / / / /  / //  |/ / / __   / /   / /    / /
/ /___/ /_/ / /  / / /  / / /_/ / / / _/ // /|  / /_/ /  / /___/ /____/ /
\____/\____/_/  /_/_/  /_/\____/ /_/ /___/_/ |_/\____/   \____/_____/___/
Copyright ยฉ 2023 AAU

Would you like to initialize using the values saved in your preferences file, or manually input them?
	Enter 'f' for file values or 'm' for manual input: m
What are the origin and destination for your trip?
	๐Ÿ“ Enter origin location: Bispebjerg
	๐Ÿ“ Enter destination location: sydhavn
Do you want the trip to be planned according to a departure time, or arrival time?
	Enter 'd' for departure or 'a' for arrival: a
Specify your preferred time constraints.
	Enter arrival hour (0 - 23): 16
	Enter arrival minute (0 - 59): 00
Now assign weights (from 1 to 10) to price, time, and sustainability in your choice of transport.
	๐Ÿ’ฐ Price (0 - 10): 10
	๐Ÿ•’ Time (0 - 10): 10
	๐ŸŒฒ Sustainability (0 - 10): 0
What modes of transport can your route include?
	๐Ÿƒ Walking? (y/n): n
	๐Ÿšด Biking? (y/n): n
	๐Ÿš‚ Trains? (y/n): n
	๐Ÿš— Car? (y/n): y
	What is the efficiency of the car in km/l? (0 - 500): 0
Would you like to save these preferences to the preferences file?
	Save to file? (y/n): n
Request will be made to URL: https://xmlopen.rejseplanen.dk/bin/rest.exe/location?input=Bispebjerg&format=json
Request will be made to URL: https://xmlopen.rejseplanen.dk/bin/rest.exe/location?input=sydhavn&format=json
Origin location ID: 008600739
Destination location ID: 008600760
Request will be made to URL: https://xmlopen.rejseplanen.dk/bin/rest.exe/trip?originId=008600739&destId=008600760&format=json&time=16:0&searchForArrival=1&useBus=0
There are 3 distinct routes available for this trip.
Request will be made to URL: http://webapp.rejseplanen.dk/bin//rest.exe/journeyDetail?ref=797733%2F287368%2F909818%2F189047%2F86%3Fdate%3D23.12.23%26station_evaId%3D8600739%26format%3Djson
Leg: 1, number of stops: 3
Request will be made to URL: http://webapp.rejseplanen.dk/bin//rest.exe/journeyDetail?ref=905844%2F355974%2F732386%2F64245%2F86%3Fdate%3D23.12.23%26station_evaId%3D8600655%26format%3Djson
Leg: 2, number of stops: 9
Total number of stops on trip: 12
Request will be made to URL: http://webapp.rejseplanen.dk/bin//rest.exe/journeyDetail?ref=797733%2F287368%2F909818%2F189047%2F86%3Fdate%3D23.12.23%26station_evaId%3D8600739%26format%3Djson
Request will be made to URL: http://webapp.rejseplanen.dk/bin//rest.exe/journeyDetail?ref=905844%2F355974%2F732386%2F64245%2F86%3Fdate%3D23.12.23%26station_evaId%3D8600655%26format%3Djson
Request will be made to URL: http://webapp.rejseplanen.dk/bin//rest.exe/journeyDetail?ref=797733%2F287368%2F909818%2F189047%2F86%3Fdate%3D23.12.23%26station_evaId%3D8600739%26format%3Djson
Request will be made to URL: http://webapp.rejseplanen.dk/bin//rest.exe/journeyDetail?ref=905844%2F355974%2F732386%2F64245%2F86%3Fdate%3D23.12.23%26station_evaId%3D8600655%26format%3Djson
Request will be made to URL: http://webapp.rejseplanen.dk/bin//rest.exe/journeyDetail?ref=797733%2F287368%2F909818%2F189047%2F86%3Fdate%3D23.12.23%26station_evaId%3D8600739%26format%3Djson
Request will be made to URL: http://webapp.rejseplanen.dk/bin//rest.exe/journeyDetail?ref=905844%2F355974%2F732386%2F64245%2F86%3Fdate%3D23.12.23%26station_evaId%3D8600655%26format%3Djson

-----------------------------------------------------------------
Priority 1: ID:   0 Distance:     13 P:    780 T:     30 E:      6 --- Ps: 1.00 Ts: 1.00 Es: 1.00 --- Os: 0.00 
Priority 2: ID:   1 Distance:     13 P:    780 T:     31 E:      6 --- Ps: 1.00 Ts: 0.00 Es: 1.00 --- Os: 0.00 
Priority 3: ID:   2 Distance:     13 P:    780 T:     30 E:      6 --- Ps: 1.00 Ts: 1.00 Es: 1.00 --- Os: 0.00 
-----------------------------------------------------------------

	View route details (number), sort the list (Price (P),Time (T), Environment (E), Overall (O)) or terminate (Q):  Error opening user preferences file: No such file or directory
Error opening user preferences file: No such file or directory
Error opening user preferences file: No such file or directory
Error opening user preferences file: No such file or directory
Error opening user preferences file: No such file or directory
Error opening user preferences file: No such file or directory
Error opening user preferences file: No such file or directory
Error opening user preferences file: No such file or directory
Error opening user preferences file: No such file or directory
Error opening user preferences file: No such file or directory
Error opening user preferences file: No such file or directory
Error opening user preferences file: No such file or directory
q

Inaccurate time calculations

The calculations were done assuming that the car speed (for the most part) is 120 km/h. Upon comparing the results to Google Maps, the time was shorter. Consider changing the speed to 100 km/h and write about it in the report. Idiot.

Output seems wrong

Bug report

Info

Version commit: f440721
CMAKE_BUILD_TYPE: Release

Description

There are some issues with the evaluation, sorting and output logic:

  1. The data doesn't seem to come from the API, as e.g. the distance is the same for all routes.
  2. No matter which sorting option is used, the results are always the same.
WELCOME TO THE PERSONALIZED INTERACTIVE
   __________  __  _____  _____  _____________   ________   ________    ____
  / ____/ __ \/  |/  /  |/  / / / /_  __/  _/ | / / ____/  / ____/ /   /  _/
 / /   / / / / /|_/ / /|_/ / / / / / /  / //  |/ / / __   / /   / /    / /
/ /___/ /_/ / /  / / /  / / /_/ / / / _/ // /|  / /_/ /  / /___/ /____/ /
\____/\____/_/  /_/_/  /_/\____/ /_/ /___/_/ |_/\____/   \____/_____/___/
Copyright ยฉ 2023 AAU

Would you like to initialize using the values saved in your preferences file, or manually input them?
	Enter 'f' for file values or 'm' for manual input: m
What are the origin and destination for your trip?
	๐Ÿ“ Enter origin location: Bispebjerg
	๐Ÿ“ Enter destination location: Sydhavn
Do you want the trip to be planned according to a departure time, or arrival time?
	Enter 'd' for departure or 'a' for arrival: a
Specify your preferred time constraints.
	Enter arrival hour (0 - 23): 20
	Enter arrival minute (0 - 59): 0
Now assign weights (from 1 to 10) to price, time, and sustainability in your choice of transport.
	๐Ÿ’ฐ Price (0 - 10): 10
	๐Ÿ•’ Time (0 - 10): 10
	๐ŸŒฒ Sustainability (0 - 10): 0
What modes of transport can your route include?
	๐Ÿƒ Walking? (y/n): n
	๐Ÿšด Biking? (y/n): n
	๐Ÿš‚ Trains? (y/n): n
	๐Ÿš— Car? (y/n): y
	What is the efficiency of the car in km/l? (0 - 500): 0
Would you like to save these preferences to the preferences file?
	Save to file? (y/n): y
There are 3 distinct routes available for this trip.

-----------------------------------------------------------------
Priority 1: Distance:      9 P:    780 T:     30 E:      4 --- Ps: 1.00 Ts: 1.00 Es: 1.00 --- Os: 1.00 
Priority 2: Distance:      9 P:    780 T:     30 E:      4 --- Ps: 1.00 Ts: 1.00 Es: 1.00 --- Os: 1.00 
Priority 3: Distance:      9 P:    780 T:     31 E:      4 --- Ps: 1.00 Ts: 0.00 Es: 1.00 --- Os: 0.50 
-----------------------------------------------------------------

	View route details (number), sort the list (Price (P),Time (T), Environment (E), Overall (O)) or terminate (Q):  p

-----------------------------------------------------------------
Priority 1: Distance:      9 P:    780 T:     30 E:      4 --- Ps: 1.00 Ts: 1.00 Es: 1.00 --- Os: 1.00 
Priority 2: Distance:      9 P:    780 T:     30 E:      4 --- Ps: 1.00 Ts: 1.00 Es: 1.00 --- Os: 1.00 
Priority 3: Distance:      9 P:    780 T:     31 E:      4 --- Ps: 1.00 Ts: 0.00 Es: 1.00 --- Os: 0.50 
-----------------------------------------------------------------

	View route details (number), sort the list (Price (P),Time (T), Environment (E), Overall (O)) or terminate (Q):  t

-----------------------------------------------------------------
Priority 1: Distance:      9 P:    780 T:     30 E:      4 --- Ps: 1.00 Ts: 1.00 Es: 1.00 --- Os: 1.00 
Priority 2: Distance:      9 P:    780 T:     30 E:      4 --- Ps: 1.00 Ts: 1.00 Es: 1.00 --- Os: 1.00 
Priority 3: Distance:      9 P:    780 T:     31 E:      4 --- Ps: 1.00 Ts: 0.00 Es: 1.00 --- Os: 0.50 
-----------------------------------------------------------------

	View route details (number), sort the list (Price (P),Time (T), Environment (E), Overall (O)) or terminate (Q):  e

-----------------------------------------------------------------
Priority 1: Distance:      9 P:    780 T:     30 E:      4 --- Ps: 1.00 Ts: 1.00 Es: 1.00 --- Os: 1.00 
Priority 2: Distance:      9 P:    780 T:     30 E:      4 --- Ps: 1.00 Ts: 1.00 Es: 1.00 --- Os: 1.00 
Priority 3: Distance:      9 P:    780 T:     31 E:      4 --- Ps: 1.00 Ts: 0.00 Es: 1.00 --- Os: 0.50 
-----------------------------------------------------------------

	View route details (number), sort the list (Price (P),Time (T), Environment (E), Overall (O)) or terminate (Q):  o

-----------------------------------------------------------------
Priority 1: Distance:      9 P:    780 T:     30 E:      4 --- Ps: 1.00 Ts: 1.00 Es: 1.00 --- Os: 1.00 
Priority 2: Distance:      9 P:    780 T:     30 E:      4 --- Ps: 1.00 Ts: 1.00 Es: 1.00 --- Os: 1.00 
Priority 3: Distance:      9 P:    780 T:     31 E:      4 --- Ps: 1.00 Ts: 0.00 Es: 1.00 --- Os: 0.50 
-----------------------------------------------------------------

	View route details (number), sort the list (Price (P),Time (T), Environment (E), Overall (O)) or terminate (Q):  q

Insecure preferences.c

The function "GetUserPreferences" does not work if the save file does not exist (It prints out errors).

  double GetUserPreference(const char* const key) {
  double value = 0;
  FILE* user_preferences = fopen("preferences.json", "r");

  if (!user_preferences) {
    printf("Error opening user preferences file!\n");
    return value;
  }

Arrival/Departure time is not included in the API call and therefore does not do anything usefull at the moment

In the below run of the program, the time is not accounted for:

C:\Windows\system32\wsl.exe --distribution Ubuntu --exec /bin/zsh -c "cd /mnt/c/Users/madsh/OneDrive/Dokumenter/GitHub/aau-p1-software/cmake-build-debug && /mnt/c/Users/madsh/OneDrive/Dokumenter/GitHub/aau-p1-software/cmake-build-debug/aau_p1_software"
Use predefined or manually input? (p = predefined or m = manual) :m
m
Start location :farum st
farum st
End location :vigerslev alle st
vigerslev alle st
Do you want to plan routes for Departure time? (y) Or Arrival time? (n):y
y
Input arrival/departure hour:12
12
Input arrival/departure minutes :30
30
Do you want to manually input your preferenes? (m)
Load preferences from a file (f)
Use presets? (p)
>>>p
p
Request will be made to URL: https://xmlopen.rejseplanen.dk/bin/rest.exe/location?input=farum%20st&format=json
Request will be made to URL: https://xmlopen.rejseplanen.dk/bin/rest.exe/location?input=vigerslev%20alle%20st&format=json
Origin location ID: 008600696
Destination location ID: 008600804
Request will be made to URL: https://xmlopen.rejseplanen.dk/bin/rest.exe/trip?originId=008600696&destId=008600804&format=json&useBus=0
There are 3 distinct routes available for this trip.
Request will be made to URL: http://webapp.rejseplanen.dk/bin//rest.exe/journeyDetail?ref=889065%2F348440%2F394726%2F98992%2F86%3Fdate%3D18.12.23%26station_evaId%3D8600696%26format%3Djson
Leg: 1, number of stops: 12
Request will be made to URL: http://webapp.rejseplanen.dk/bin//rest.exe/journeyDetail?ref=840564%2F301973%2F197710%2F181340%2F86%3Fdate%3D18.12.23%26station_evaId%3D8600644%26format%3Djson
Leg: 2, number of stops: 10
Total number of stops on trip: 22

Priority 1: ID: 2 P: 240.00 T: 18.00 E: 374.00 --- Ps: 1.00 Ts: 1.00 Es: 0.00 --- Os: 1.00.
Priority 2: ID: 0 P: 381.00 T: 304.00 E: 219.00 --- Ps: 0.40 Ts: 0.00 Es: 0.43 --- Os: 0.34.
Priority 3: ID: 1 P: 474.00 T: 75.00 E: 17.00 --- Ps: 0.00 Ts: 0.80 Es: 1.00 --- Os: 0.20.

View route details (number), sort the list (Price (P),Time (T), Environment (E), Overall (O)) or terminate (Q):1
1
You entered: 1
Number of legs in the chosen trip: 2

Leg 1:
Transportation name: B
Transportation type: S

Origin station name: Farum St.
Origin station time: 19:31
Origin station date: 18.12.23
Origin station Track: 2

Destination station name: Ryparken St.
Destination station time: 19:56
Destination station date: 18.12.23
Destination station Track: 2

Leg 2:
Transportation name: F
Transportation type: S

Origin station name: Ryparken St.
Origin station time: 20:04
Origin station date: 18.12.23
Origin station Track: 12

Destination station name: Vigerslev Alle St.
Destination station time: 20:17
Destination station date: 18.12.23
Destination station Track: 12

View route details (number), sort the list (Price (P),Time (T), Environment (E), Overall (O)) or terminate (Q):

Failing tests

Some of the tests in calculations.cc are failing because strings are compared to doubles with EXPECT_STREQ. See:

/**
* TODO(martinkedmenec): Fix the following tests. `EXPECT_STREQ` cannot compare
* a string to a double!
*/
// TEST(CalculateTimeTest, Car200km) {
// const CalculateTimeParameters kParameters = {kCar, 230, "NULL", "NULL"};
// EXPECT_STREQ("02:16", CalculateTime(&kParameters));
// }
// TEST(CalculateTimeTest, Ev354km) {
// const CalculateTimeParameters kParameters = {kEv, 354, "NULL", "NULL"};
// EXPECT_STREQ("03:18", CalculateTime(&kParameters));
// }
// TEST(CalculateTimeTest, Bike40km) {
// const CalculateTimeParameters kParameters = {kBike, 40, "NULL", "NULL"};
// EXPECT_STREQ("02:17", CalculateTime(&kParameters));
// }
// TEST(CalculateTimeTest, Walk20km) {
// const CalculateTimeParameters kParameters = {kWalk, 20, "NULL", "NULL"};
// EXPECT_STREQ("04:20", CalculateTime(&kParameters));
// }
// TEST(CalculateTimeTest, Train1020to1343) {
// const CalculateTimeParameters kParameters = {kTrain, 0, "10:20", "13:43"};
// EXPECT_STREQ("03:23", CalculateTime(&kParameters));
// }
// TEST(CalculateTimeTest, Bus2346to0013) {
// const CalculateTimeParameters kParameters = {kBus, 0, "23:46", "00:13"};
// EXPECT_STREQ("00:27", CalculateTime(&kParameters));
// }

I have disabled these tests in one of the last PRs, but they should be fixed and enabled again.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.