Skip to content

Commit 5f1c99a

Browse files
committed
Add seconds to durations for use in promo
1 parent bf6c659 commit 5f1c99a

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

mock/data/events.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@
140140
"title": "3-day Happiness Workshop",
141141
"hashed_id": "8553",
142142
"type": {
143-
"id": 1126,
144-
"name": "Practitioner Course Level 1",
143+
"id": 1127,
144+
"name": "Practitioner Course Level 2",
145145
"min_hours": 1,
146146
"free": true
147147
},
@@ -199,7 +199,7 @@
199199
"title": "4-day Awesomeness Workshop",
200200
"hashed_id": "8329",
201201
"type": {
202-
"id": 1126,
202+
"id": 1128,
203203
"name": "Practitioner Course Level 1",
204204
"min_hours": 1,
205205
"free": true

site/pages/schedule.html

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,22 @@
99
<div id="wsb-event-list"></div>
1010
<div id="wsb-event-list-2"></div>
1111
<script>
12+
/**
13+
* Returns the value of query parameter or null if the parameter is not found
14+
* @param name {string}
15+
*/
16+
function getQueryParam(name) {
17+
const params = new Proxy(new URLSearchParams(window.location.search), {
18+
get: (searchParams, prop) => searchParams.get(prop),
19+
});
20+
return params[name];
21+
}
22+
23+
1224
const apiKey = siteConfig.apiKey;
1325
const themeName = siteConfig.theme ? siteConfig.theme : 'alfred';
26+
const typesParams = getQueryParam('types');
27+
const types = typesParams?.split(',');
1428
document.addEventListener('wsbwidgetsloaded', function() {
1529
const widgets = [
1630
{
@@ -20,10 +34,11 @@
2034
cols: ['schedule', 'location', 'language', 'trainers', 'title', 'register'],
2135
registration: true,
2236
table: true,
37+
typeIds: types,
2338
eventPageUrl: '/event-page',
2439
registrationPageUrl: '/registration',
2540
trainerName: true,
26-
filters: ['type', 'location', 'language', 'trainer'],
41+
filters: ['type','location', 'language', 'trainer'],
2742
}
2843
];
2944
const config = {

src/models/utils/Duration.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ export default class Duration {
55
readonly days: number;
66
readonly hours: number;
77
readonly minutes: number;
8+
readonly seconds: number;
89

910
constructor(duration: LuxonDuration) {
1011
this.days = Math.floor(duration.as('days'));
1112
this.hours = Math.floor(duration.as('hours')) - this.days * 24;
1213
this.minutes = Math.floor(duration.as('minutes')) - (this.days * 24 + this.hours) * 60;
14+
this.seconds = Math.floor(duration.as('seconds')) - ((this.days * 24 + this.hours) * 60 + this.minutes) * 60;
1315
}
1416
}

0 commit comments

Comments
 (0)