Skip to content

Commit

Permalink
fix: timetable proper day used
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurBeaulieu committed Jul 14, 2024
1 parent c00e4d7 commit f265e05
Show file tree
Hide file tree
Showing 23 changed files with 12 additions and 1,129 deletions.
2 changes: 1 addition & 1 deletion assets/dist/MonDourdannais.bundle.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions web/src/js/MonDourdannais.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class MonDourdannais {
const promises = [];
for (let i = 0; i < Utils.CCDH_CITIES.length; ++i) {
promises.push(new Promise(resolveLocal => {
fetch(`./assets/json/citybounds/${Utils.CCDH_CITIES[i]}.json`).then(data => {
fetch(`/assets/json/citybounds/${Utils.CCDH_CITIES[i]}.json`).then(data => {
data.json().then(jsonData => {
this._cityBounds[Utils.CCDH_CITIES[i]] = jsonData;
resolveLocal();
Expand Down Expand Up @@ -133,7 +133,7 @@ class MonDourdannais {
const promises = [];
for (let i = 0; i < Utils.CCDH_CITIES.length; ++i) {
promises.push(new Promise(resolveLocal => {
fetch(`./assets/json/citymarkers/${Utils.CCDH_CITIES[i]}.json`).then(data => {
fetch(`/assets/json/citymarkers/${Utils.CCDH_CITIES[i]}.json`).then(data => {
data.json().then(jsonData => {
this._cityMarkers[Utils.CCDH_CITIES[i]] = jsonData.markers;
resolveLocal();
Expand Down Expand Up @@ -178,7 +178,7 @@ class MonDourdannais {

_fetchTransportationLines() {
return new Promise(resolve => {
fetch(`./assets/json/transportation/transportation.json`).then(data => {
fetch(`/assets/json/transportation/transportation.json`).then(data => {
data.json().then(jsonData => {
this._transportationLines = jsonData;
resolve();
Expand Down
10 changes: 5 additions & 5 deletions web/src/js/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ const version = '0.0.1';
const port = 8020;
const app = express();
// Log
console.log(`${(new Date()).toISOString()} | HomeMap v${version} | Starting server and proxy`);
console.log(`${(new Date()).toISOString()} | MonDourdannais v${version} | Starting server and proxy`);
// Ensure responses are compressed through this midleware
app.use(compression({
level: zlib.constants.Z_BEST_COMPRESSION,
}));
// url definitions
app.use('/assets', express.static(path.join(__dirname, '../../assets'), { // Serve static files
app.use('/assets', express.static(path.join(__dirname, '../../../assets'), { // Serve static files
maxAge: '864000000' // 10 days caching for app assets
}));
// Serve main html at /
app.get('/', (req, res) => {
console.log(`${(new Date()).toISOString()} | HomeMap v${version} | index.html page requested`);
res.sendFile(path.join(__dirname, '../../index.html'));
console.log(`${(new Date()).toISOString()} | MonDourdannais v${version} | index.html page requested`);
res.sendFile(path.join(__dirname, '../../../index.html'));
});

// Start server console
app.listen(port, () => {
console.log(`${(new Date()).toISOString()} | HomeMap v${version} | Server started and listening on port ${port}`);
console.log(`${(new Date()).toISOString()} | MonDourdannais v${version} | Server started and listening on port ${port}`);
});
4 changes: 2 additions & 2 deletions web/src/js/map/MapFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ class MapFactory {
minutes = `0${minutes}`;
}

const dayOfWeek = now.getDay() - 1;
const dayOfWeek = (now.getDay() - 1 + 7) % 7;
const openingTime = parseInt(`${timetable[dayOfWeek].open.h}${timetable[dayOfWeek].open.m}`);
const closingTime = parseInt(`${timetable[dayOfWeek].close.h}${timetable[dayOfWeek].close.m}`);
const currentTime = parseInt(`${hour}${minutes}`);
Expand Down Expand Up @@ -248,7 +248,7 @@ class MapFactory {
dom.querySelector('#mark-state').appendChild(this.markerOpenedState(opts.timetable));
// Now update day by day
const now = new Date();
const dayOfWeek = now.getDay() - 1;
const dayOfWeek = (now.getDay() - 1 + 7) % 7;
for (let i = 0; i < opts.timetable.length; ++i) {
const dayDom = dom.querySelector('#timetable').children[i];
if (opts.timetable[i].isOpen === true) {
Expand Down
2 changes: 1 addition & 1 deletion web/src/js/utils/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const precisionRound = (value, precision) => {

const fetchModal = (url) => {
return new Promise(resolve => {
fetch(`./assets/html/${url}.html`).then(data => {
fetch(`/assets/html/${url}.html`).then(data => {
data.text().then(html => {
resolve(document.createRange().createContextualFragment(html));
});
Expand Down
17 changes: 0 additions & 17 deletions windows/.gitignore

This file was deleted.

108 changes: 0 additions & 108 deletions windows/CMakeLists.txt

This file was deleted.

109 changes: 0 additions & 109 deletions windows/flutter/CMakeLists.txt

This file was deleted.

23 changes: 0 additions & 23 deletions windows/flutter/generated_plugin_registrant.cc

This file was deleted.

15 changes: 0 additions & 15 deletions windows/flutter/generated_plugin_registrant.h

This file was deleted.

27 changes: 0 additions & 27 deletions windows/flutter/generated_plugins.cmake

This file was deleted.

Loading

0 comments on commit f265e05

Please sign in to comment.