Skip to content

Commit

Permalink
aggiunta modalità test
Browse files Browse the repository at this point in the history
così rimuoviamo il repository test
  • Loading branch information
paolini committed Feb 7, 2024
1 parent 7c17748 commit 8fe4b4f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ Pagina HTML da visualizzare sullo schermo nell'atrio del dipartimento

Lo puoi vedere qui:
produzione: https://unipisa.github.io/dm-monitor/
test: https://unipisa.github.io/dm-monitor-test/
test: https://unipisa.github.io/dm-monitor/?test
4 changes: 3 additions & 1 deletion fullscreenImagePage.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
class FullScreenImagePage {
constructor({imageUrl,start,end}) {
constructor({imageUrl,start,end,test}) {
this.imageUrl = imageUrl
this.startDate = start
this.endDate = end
this.test = test
console.log(`constructor ${this.start}`)
}

Expand Down Expand Up @@ -34,6 +35,7 @@ class FullScreenImagePage {
}

priority() {
if (this.test) return 1
const showSpecialStart = moment.tz(this.startDate, "Europe/Rome").unix()
const showSpecialEnd = moment.tz(this.endDate, "Europe/Rome").unix()
if (moment().unix() >= showSpecialStart && moment().unix() <= showSpecialEnd) {
Expand Down
9 changes: 8 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
// true se si aggiunge ?test alla fine dell'URL
const TEST = window.location.search.includes('test')

const pages = [
new FullScreenImagePage({
imageUrl: "images/colloquium_levine.png?d=20231213x",
start: "2024-02-19 06:00",
end: "2024-02-19 18:44"
end: "2024-02-19 18:44",
test: TEST, // mostra sempre in modalità test
}),

new EventsAndVisitorsPage(),
Expand All @@ -15,6 +19,7 @@ const pages = [
url: "https://lab.phc.dm.unipi.it/problemi/jumbotron",
duration: 60000,
priority: () => {
if (TEST) return 1 // mostra sempre in modalità test
// show with high priority
// between 7pm and 7am
const date = moment().tz("Europe/Rome").format('HH-mm')
Expand All @@ -27,6 +32,7 @@ const pages = [
url: "https://montblanc.panomax.com/",
duration: 60000,
priority: () => {
if (TEST) return 1 // mostra sempre in modalità test
// show only in minute 14
const date = moment().tz("Europe/Rome").format('mm')
if (date === '42') return 3
Expand All @@ -40,6 +46,7 @@ const pages = [
url: "https://zoncolan.panomax.com/",
duration: 60000,
priority: () => {
if (TEST) return 1 // mostra sempre in modalità test
// show only in minute 19
const date = moment().tz("Europe/Rome").format('mm')
if (date === '19') return 3
Expand Down

0 comments on commit 8fe4b4f

Please sign in to comment.