Fix lucky number (#10)

* Add moment-timezone dependency

* Make lucky number show from 7AM
This commit is contained in:
Kacper Ziubryniewicz 2019-02-05 11:25:42 +01:00 committed by Mikołaj Pich
parent 41eaed7024
commit 65152a10e9
4 changed files with 24 additions and 7 deletions

13
package-lock.json generated
View file

@ -2926,6 +2926,19 @@
"minimist": "0.0.8"
}
},
"moment": {
"version": "2.24.0",
"resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz",
"integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg=="
},
"moment-timezone": {
"version": "0.5.23",
"resolved": "https://registry.npmjs.org/moment-timezone/-/moment-timezone-0.5.23.tgz",
"integrity": "sha512-WHFH85DkCfiNMDX5D3X7hpNH3/PUhjTGcD0U1SgfBGZxJ3qUmJh5FdvaFjcClxOvB3rzdfj4oRffbI38jEnC1w==",
"requires": {
"moment": ">= 2.9.0"
}
},
"morgan": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/morgan/-/morgan-1.9.1.tgz",

View file

@ -15,6 +15,7 @@
"express": "~4.16.4",
"express-subdomain": "^1.0.5",
"md5": "^2.2.1",
"moment-timezone": "^0.5.23",
"morgan": "~1.9.1",
"node-sass-middleware": "^0.11.0",
"pug": "^2.0.3",

View file

@ -1,6 +1,7 @@
const express = require('express');
const router = express.Router();
const protocol = require('../utils/connection');
const moment = require('moment-timezone');
router.get("/", (req, res) => {
res.render("log-exception", {
@ -34,9 +35,10 @@ router.post("(/*)?", (req, res) => {
});
router.get("/Default/Start.mvc/Index", (req, res) => {
let now = moment().tz('Europe/Warsaw');
res.render("homepage", {
title: "Uonet+",
luckyNumber: new Date().getDate(),
luckyNumber: now.hour() >= 7 ? now.date() : null,
uonetplusOpiekun: protocol(req) + "://" + req.get('host').replace("uonetplus", "uonetplus-opiekun"),
uonetplusUczen: protocol(req) + "://" + req.get('host').replace("uonetplus", "uonetplus-uczen")
});

View file

@ -60,10 +60,11 @@ block content
#idEmptyAppUczenExt
.name Uczeń NOWOŚĆ
div.panel.szczesliweNumery.klient
.imagedHeader
.name Szczęśliwy numer w dzienniku
.subDiv.pCont
if luckyNumber
div.panel.szczesliweNumery.klient
.imagedHeader
.name Szczęśliwy numer w dzienniku
.subDiv.pCont
.header SP
.subDiv Szczęśliwy numer w dzienniku: #{luckyNumber}
.subDiv.pCont
.header SP
.subDiv Szczęśliwy numer w dzienniku: #{luckyNumber}