From a6ff11ff712a7601d902eff9d6e627c24a57e42c Mon Sep 17 00:00:00 2001 From: PoliEcho Date: Thu, 6 Mar 2025 15:10:31 +0100 Subject: [PATCH] add basic timetable --- src/timetable.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/timetable.cpp b/src/timetable.cpp index ff0343e..260a829 100644 --- a/src/timetable.cpp +++ b/src/timetable.cpp @@ -1,6 +1,8 @@ #include "timetable.h" +#include #include #include "net.h" +#include using nlohmann::json; @@ -13,10 +15,18 @@ using nlohmann::json; #define DEFAULT_PADDING 4 void timetable_page() { - // DONT FORGET TO UNCOMMENT - json resp_from_api = bakaapi::get_data_from_endpoint("api/3/marks"); - // std::ifstream f("test-data/marks3.json"); - // json resp_from_api = json::parse(f); + // DONT FORGET TO UNCOMMENT + // json resp_from_api = bakaapi::get_data_from_endpoint("api/3/timetable/actual"); + std::ifstream f("test-data/timetable.json"); + json resp_from_api = json::parse(f); + // calculate table size + uint8_t column_number = 0; + for(uint8_t i = 0; i < resp_from_api["Days"].size(); i++) { + (resp_from_api["Days"][i]["Atoms"].size() > column_number) ? (column_number = resp_from_api["Days"][i]["Atoms"].size()); + } + + + } \ No newline at end of file