This commit is contained in:
Dominic Grimm 2023-03-08 17:52:41 +01:00
parent e00f809d00
commit 8def898c8a
No known key found for this signature in database
GPG key ID: 6F294212DEAAC530
9 changed files with 136 additions and 256 deletions

View file

@ -24,7 +24,6 @@ lazy_static! {
}
pub mod keys {
pub const HTML: &str = "html";
pub const DISPLAY_HTML: &str = "disp_html";
}

View file

@ -45,7 +45,7 @@ async fn fetch_schoolyears(client: &untis::Client, db_conn: &mut db::Connection)
async fn fetch_current_tenant(
client: &untis::Client,
db_conn: &mut PgConnection,
db_conn: &mut db::Connection,
schoolyear_id: i32,
) -> Result<()> {
let tenant = client.current_tenant().await?;
@ -94,7 +94,7 @@ async fn fetch_current_tenant(
async fn fetch_timegrid(
client: &untis::Client,
db_conn: &mut PgConnection,
db_conn: &mut db::Connection,
schoolyear_id: i32,
) -> Result<()> {
let days = client.timegrid().await?;
@ -138,7 +138,7 @@ async fn fetch_timegrid(
async fn fetch_teachers(
client: &untis::Client,
db_conn: &mut PgConnection,
db_conn: &mut db::Connection,
schoolyear_id: i32,
) -> Result<()> {
let existing_teachers = db::schema::teachers::table
@ -172,7 +172,7 @@ async fn fetch_teachers(
async fn fetch_classes(
client: &untis::Client,
db_conn: &mut PgConnection,
db_conn: &mut db::Connection,
schoolyear_id: i32,
) -> Result<()> {
let existing_classes = db::schema::classes::table
@ -202,7 +202,7 @@ async fn fetch_classes(
async fn fetch_subjects(
client: &untis::Client,
db_conn: &mut PgConnection,
db_conn: &mut db::Connection,
schoolyear_id: i32,
) -> Result<()> {
let existing_classes = db::schema::subjects::table
@ -231,7 +231,7 @@ async fn fetch_subjects(
async fn fetch_rooms(
client: &untis::Client,
db_conn: &mut PgConnection,
db_conn: &mut db::Connection,
schoolyear_id: i32,
) -> Result<()> {
let existing_classes = db::schema::rooms::table
@ -260,7 +260,7 @@ async fn fetch_rooms(
async fn fetch_departments(
client: &untis::Client,
db_conn: &mut PgConnection,
db_conn: &mut db::Connection,
schoolyear_id: i32,
) -> Result<()> {
let existing_classes = db::schema::departments::table
@ -289,7 +289,7 @@ async fn fetch_departments(
async fn fetch_holidays(
client: &untis::Client,
db_conn: &mut PgConnection,
db_conn: &mut db::Connection,
schoolyear_id: i32,
) -> Result<()> {
let existing_classes = db::schema::holidays::table

View file

@ -2,9 +2,11 @@
<html lang="de-DE">
<head>
<meta charset="UTF-8" />
<meta name="description" content="Besserer Vertretungsplan" />
<meta name="author" content="Dominic Grimm" />
<meta name="generator" content="BVplan" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="generator" content="BVplan" />
<title>{% block title %}{% endblock %} | dergrimm.net</title>
<link rel="shortcut icon" href="/static/favicon.ico" />

View file

@ -10,128 +10,9 @@
{% block body %}
<body>
<header id="info">
<div id="title-wrapper" class="column">
<h1 id="title">BVplan</h1>
<span id="subtitle">dergrimm.net</span>
</div>
<div id="tenant-info" class="column">
<span>{{ data.tenant }}, {{ data.schoolyear }}</span>
<br />
<span>Stand: {{ data.queried_at }}</span>
<br />
<span>Vertretungsplan (offline): {{ data.last_import_time }}</span>
</div>
</header>
<main>
<table id="plan">
<caption>
{{ data.date }}, Woche {{ data.week_type }}
</caption>
<colgroup>
<col />
<col />
<col />
<col style="width: 30%" />
<col />
<col />
<col />
<col style="width: 20%" />
</colgroup>
<thead>
<tr>
<th>Stunde</th>
<th>Klasse(n)</th>
<th>(Fach)</th>
<th>Fach</th>
<th>Vertreter</th>
<th>(Raum)</th>
<th>Raum</th>
<th>Text</th>
</tr>
</thead>
<tbody>
{% for subst in data.substitutions %}
<tr>
<td>{{ subst.period }}</td>
<td>{{ subst.classes|join(", ") }}</td>
<td>
{% match subst.prev_subject %}
{% when Some with (x) %}
{{ x }}
{% when None %}
---
{% endmatch %}
</td>
<td>
{% match subst.subject %}
{% when Some with (x) %}
{{ x }}
{% when None %}
---
{% endmatch %}
</td>
<td>
{% match subst.teachers %}
{% when Some with (x) %}
{{ x|join(", ") }}
{% when None %}
---
{% endmatch %}
</td>
<td>
{% if subst.prev_rooms.is_empty() %}
---
{% else %}
{{ subst.prev_rooms|join(", ") }}
{% endif %}
</td>
<td>
{% if subst.rooms.is_empty() %}
---
{% else %}
{{ subst.rooms|join(", ") }}
{% endif %}
</td>
<td>
{% match subst.text %}
{% when Some with (x) %}
{{ x }}
{% when None %}
{% endmatch %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</main>
<footer id="footer">
<div class="element">
<p>
BVplan - der bessere Vertretungsplan sogar mit UTF-8 Support!
Wow
</p>
<p>
<a href="https://git.dergrimm.net/dergrimm/bvplan">
https://git.dergrimm.net/dergrimm/bvplan
</a>
</p>
</div>
<hr />
<p class="element">
<code>
Powered by Dominic Grimm &lt;<a
href="mailto:dominic@dergrimm.net"
>dominic@dergrimm.net</a
>&gt;, Untis sucks
</code>
</p>
</footer>
{% include "header.html" %}
{% include "main.html" %}
{% include "footer.html" %}
<script src="/static/js/bvplan.js"></script>
<script>

View file

@ -10,128 +10,9 @@
{% block body %}
<body class="display">
<header id="info">
<div id="title-wrapper" class="column">
<h1 id="title">BVplan</h1>
<span id="subtitle">dergrimm.net</span>
</div>
<div id="tenant-info" class="column">
<span>{{ data.tenant }}, {{ data.schoolyear }}</span>
<br />
<span>Stand: {{ data.queried_at }}</span>
<br />
<span>Vertretungsplan (offline): {{ data.last_import_time }}</span>
</div>
</header>
<main>
<table id="plan">
<caption>
{{ data.date }}, Woche {{ data.week_type }}
</caption>
<colgroup>
<col />
<col />
<col />
<col style="width: 30%" />
<col />
<col />
<col />
<col style="width: 20%" />
</colgroup>
<thead>
<tr>
<th>Stunde</th>
<th>Klasse(n)</th>
<th>(Fach)</th>
<th>Fach</th>
<th>Vertreter</th>
<th>(Raum)</th>
<th>Raum</th>
<th>Text</th>
</tr>
</thead>
<tbody>
{% for subst in data.substitutions %}
<tr>
<td>{{ subst.period }}</td>
<td>{{ subst.classes|join(", ") }}</td>
<td>
{% match subst.prev_subject %}
{% when Some with (x) %}
{{ x }}
{% when None %}
---
{% endmatch %}
</td>
<td>
{% match subst.subject %}
{% when Some with (x) %}
{{ x }}
{% when None %}
---
{% endmatch %}
</td>
<td>
{% match subst.teachers %}
{% when Some with (x) %}
{{ x|join(", ") }}
{% when None %}
---
{% endmatch %}
</td>
<td>
{% if subst.prev_rooms.is_empty() %}
---
{% else %}
{{ subst.prev_rooms|join(", ") }}
{% endif %}
</td>
<td>
{% if subst.rooms.is_empty() %}
---
{% else %}
{{ subst.rooms|join(", ") }}
{% endif %}
</td>
<td>
{% match subst.text %}
{% when Some with (x) %}
{{ x }}
{% when None %}
{% endmatch %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</main>
<footer id="footer">
<div class="element">
<p>
BVplan - der bessere Vertretungsplan sogar mit UTF-8 Support!
Wow
</p>
<p>
<a href="https://git.dergrimm.net/dergrimm/bvplan">
https://git.dergrimm.net/dergrimm/bvplan
</a>
</p>
</div>
<hr />
<p class="element">
<code>
Powered by Dominic Grimm &lt;<a
href="mailto:dominic@dergrimm.net"
>dominic@dergrimm.net</a
>&gt;, Untis sucks
</code>
</p>
</footer>
{% include "header.html" %}
{% include "main.html" %}
{% include "footer.html" %}
<script src="/static/js/bvplan.js"></script>
<script>

View file

@ -0,0 +1,21 @@
<footer id="footer">
<div class="element">
<p>
BVplan - der bessere Vertretungsplan sogar mit UTF-8 Support!
</p>
<p>
<a href="https://git.dergrimm.net/dergrimm/bvplan">
https://git.dergrimm.net/dergrimm/bvplan
</a>
</p>
</div>
<hr />
<p class="element">
<code>
Powered by Dominic Grimm &lt;<a
href="mailto:dominic@dergrimm.net"
>dominic@dergrimm.net</a
>&gt;, Untis' APIs suck
</code>
</p>
</footer>

View file

@ -0,0 +1,13 @@
<header id="info">
<div id="title-wrapper" class="column">
<h1 id="title">BVplan</h1>
<span id="subtitle">dergrimm.net</span>
</div>
<div id="tenant-info" class="column">
<span>{{ data.tenant }}, {{ data.schoolyear }}</span>
<br />
<span>Stand: {{ data.queried_at }}</span>
<br />
<span>Vertretungsplan (offline): {{ data.last_import_time }}</span>
</div>
</header>

View file

@ -0,0 +1,85 @@
<main>
<table id="plan">
<caption>
{{ data.date }}, Woche {{ data.week_type }}
</caption>
<colgroup>
<col />
<col />
<col />
<col style="width: 30%" />
<col />
<col />
<col />
<col style="width: 20%" />
</colgroup>
<thead>
<tr>
<th>Stunde</th>
<th>Klasse(n)</th>
<th>(Fach)</th>
<th>Fach</th>
<th>Vertreter</th>
<th>(Raum)</th>
<th>Raum</th>
<th>Text</th>
</tr>
</thead>
<tbody>
{% for subst in data.substitutions %}
<tr>
<td>{{ subst.period }}</td>
<td>{{ subst.classes|join(", ") }}</td>
<td>
{% match subst.prev_subject %}
{% when Some with (x) %}
{{ x }}
{% when None %}
---
{% endmatch %}
</td>
<td>
{% match subst.subject %}
{% when Some with (x) %}
{{ x }}
{% when None %}
---
{% endmatch %}
</td>
<td>
{% match subst.teachers %}
{% when Some with (x) %}
{{ x|join(", ") }}
{% when None %}
---
{% endmatch %}
</td>
<td>
{% if subst.prev_rooms.is_empty() %}
---
{% else %}
{{ subst.prev_rooms|join(", ") }}
{% endif %}
</td>
<td>
{% if subst.rooms.is_empty() %}
---
{% else %}
{{ subst.rooms|join(", ") }}
{% endif %}
</td>
<td>
{% match subst.text %}
{% when Some with (x) %}
{{ x }}
{% when None %}
{% endmatch %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</main>

View file

@ -99,5 +99,3 @@ volumes:
db:
rabbitmq:
redis: