add basic timetable
Some checks are pending
/ sync-to-origin (push) Waiting to run

This commit is contained in:
PoliEcho 2025-03-06 15:10:31 +01:00
parent 87c2e2e01c
commit a6ff11ff71

View File

@ -1,6 +1,8 @@
#include "timetable.h"
#include <cstdint>
#include <nlohmann/json.hpp>
#include "net.h"
#include <fstream>
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());
}
}