-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update data availability table automatically
- Loading branch information
Showing
8 changed files
with
86 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
themes/trafiklab-2024/layouts/shortcodes/stip-data-availability-static.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{{ $data := slice }} | ||
{{ $url := "https://prod-stip-pingdom-status-export.s3.eu-central-1.amazonaws.com/data-availability.json" }} | ||
{{ with resources.GetRemote $url }} | ||
{{ $data = . | transform.Unmarshal }} | ||
{{ end }} | ||
|
||
The following table shows which operators are covered by this dataset. | ||
|
||
<table> | ||
<thead> | ||
<tr> | ||
<th>Operator</th> | ||
<th>Abbreviation</th> | ||
<th>Static data</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{{ range $key, $value := $data }} | ||
{{ if not (eq (printf "%T" $value) "string") }} | ||
{{ if eq (index $value "staticData") true }} | ||
<tr> | ||
<td>{{ .name }}</td> | ||
<td><code>{{.shortname}}</code></td> | ||
<td>{{ if eq (index $value "staticData") true }} ✔️ {{ end }}</td> | ||
</tr> | ||
{{ end }} | ||
{{ end }} | ||
{{ end }} | ||
<tr> | ||
<td class="tl-muted" colspan="3">Last updated: {{ strings.Substr (index $data "last-update") 0 10 }}</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
42 changes: 42 additions & 0 deletions
42
themes/trafiklab-2024/layouts/shortcodes/stip-data-availability.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{{ $data := slice }} | ||
{{ $url := "https://prod-stip-pingdom-status-export.s3.eu-central-1.amazonaws.com/data-availability.json" }} | ||
{{ $cacheKey := print $url (now.Format "2006-01-02") }} | ||
{{ $opts := dict "key" $cacheKey }} | ||
{{ with resources.GetRemote $url $opts }} | ||
{{ $data = . | transform.Unmarshal }} | ||
{{ end }} | ||
|
||
The following table shows which operators are covered by this dataset. | ||
|
||
<table> | ||
<thead> | ||
<tr> | ||
<th>Operator</th> | ||
<th>Abbreviation</th> | ||
<th>Static data</th> | ||
<th>Real-time data</th> | ||
<th>Vehicle positions</th> | ||
<th>Occupancy data</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{{ range $key, $value := $data }} | ||
{{ if not (eq (printf "%T" $value) "string") }} | ||
{{ if eq (index $value "staticData") true }} | ||
<tr> | ||
<td>{{ .name }}</td> | ||
<td><code>{{.shortname}}</code></td> | ||
<td>{{ if eq (index $value "staticData") true }} ✔️ {{ end }}</td> | ||
<td>{{ if eq (index $value "tripUpdates") true }} ✔️ {{ end }}</td> | ||
<td>{{ if eq (index $value "vehiclePositions") true }} ✔️ {{ end }}</td> | ||
<td>{{ if or (eq (index $value "shortname") "skane") (eq (index $value "shortname") "otraf") }} ✔️ {{ end }}</td> | ||
</tr> | ||
{{ end }} | ||
{{ end }} | ||
{{ end }} | ||
<tr> | ||
<td class="tl-muted" colspan="5">Last updated: {{ strings.Substr (index $data "last-update") 0 10 }}</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|