Update
This commit is contained in:
parent
e00f809d00
commit
8def898c8a
9 changed files with 136 additions and 256 deletions
|
@ -24,7 +24,6 @@ lazy_static! {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod keys {
|
pub mod keys {
|
||||||
|
|
||||||
pub const HTML: &str = "html";
|
pub const HTML: &str = "html";
|
||||||
pub const DISPLAY_HTML: &str = "disp_html";
|
pub const DISPLAY_HTML: &str = "disp_html";
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ async fn fetch_schoolyears(client: &untis::Client, db_conn: &mut db::Connection)
|
||||||
|
|
||||||
async fn fetch_current_tenant(
|
async fn fetch_current_tenant(
|
||||||
client: &untis::Client,
|
client: &untis::Client,
|
||||||
db_conn: &mut PgConnection,
|
db_conn: &mut db::Connection,
|
||||||
schoolyear_id: i32,
|
schoolyear_id: i32,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let tenant = client.current_tenant().await?;
|
let tenant = client.current_tenant().await?;
|
||||||
|
@ -94,7 +94,7 @@ async fn fetch_current_tenant(
|
||||||
|
|
||||||
async fn fetch_timegrid(
|
async fn fetch_timegrid(
|
||||||
client: &untis::Client,
|
client: &untis::Client,
|
||||||
db_conn: &mut PgConnection,
|
db_conn: &mut db::Connection,
|
||||||
schoolyear_id: i32,
|
schoolyear_id: i32,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let days = client.timegrid().await?;
|
let days = client.timegrid().await?;
|
||||||
|
@ -138,7 +138,7 @@ async fn fetch_timegrid(
|
||||||
|
|
||||||
async fn fetch_teachers(
|
async fn fetch_teachers(
|
||||||
client: &untis::Client,
|
client: &untis::Client,
|
||||||
db_conn: &mut PgConnection,
|
db_conn: &mut db::Connection,
|
||||||
schoolyear_id: i32,
|
schoolyear_id: i32,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let existing_teachers = db::schema::teachers::table
|
let existing_teachers = db::schema::teachers::table
|
||||||
|
@ -172,7 +172,7 @@ async fn fetch_teachers(
|
||||||
|
|
||||||
async fn fetch_classes(
|
async fn fetch_classes(
|
||||||
client: &untis::Client,
|
client: &untis::Client,
|
||||||
db_conn: &mut PgConnection,
|
db_conn: &mut db::Connection,
|
||||||
schoolyear_id: i32,
|
schoolyear_id: i32,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let existing_classes = db::schema::classes::table
|
let existing_classes = db::schema::classes::table
|
||||||
|
@ -202,7 +202,7 @@ async fn fetch_classes(
|
||||||
|
|
||||||
async fn fetch_subjects(
|
async fn fetch_subjects(
|
||||||
client: &untis::Client,
|
client: &untis::Client,
|
||||||
db_conn: &mut PgConnection,
|
db_conn: &mut db::Connection,
|
||||||
schoolyear_id: i32,
|
schoolyear_id: i32,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let existing_classes = db::schema::subjects::table
|
let existing_classes = db::schema::subjects::table
|
||||||
|
@ -231,7 +231,7 @@ async fn fetch_subjects(
|
||||||
|
|
||||||
async fn fetch_rooms(
|
async fn fetch_rooms(
|
||||||
client: &untis::Client,
|
client: &untis::Client,
|
||||||
db_conn: &mut PgConnection,
|
db_conn: &mut db::Connection,
|
||||||
schoolyear_id: i32,
|
schoolyear_id: i32,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let existing_classes = db::schema::rooms::table
|
let existing_classes = db::schema::rooms::table
|
||||||
|
@ -260,7 +260,7 @@ async fn fetch_rooms(
|
||||||
|
|
||||||
async fn fetch_departments(
|
async fn fetch_departments(
|
||||||
client: &untis::Client,
|
client: &untis::Client,
|
||||||
db_conn: &mut PgConnection,
|
db_conn: &mut db::Connection,
|
||||||
schoolyear_id: i32,
|
schoolyear_id: i32,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let existing_classes = db::schema::departments::table
|
let existing_classes = db::schema::departments::table
|
||||||
|
@ -289,7 +289,7 @@ async fn fetch_departments(
|
||||||
|
|
||||||
async fn fetch_holidays(
|
async fn fetch_holidays(
|
||||||
client: &untis::Client,
|
client: &untis::Client,
|
||||||
db_conn: &mut PgConnection,
|
db_conn: &mut db::Connection,
|
||||||
schoolyear_id: i32,
|
schoolyear_id: i32,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let existing_classes = db::schema::holidays::table
|
let existing_classes = db::schema::holidays::table
|
||||||
|
|
|
@ -2,9 +2,11 @@
|
||||||
<html lang="de-DE">
|
<html lang="de-DE">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<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 http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<meta name="generator" content="BVplan" />
|
|
||||||
<title>{% block title %}{% endblock %} | dergrimm.net</title>
|
<title>{% block title %}{% endblock %} | dergrimm.net</title>
|
||||||
|
|
||||||
<link rel="shortcut icon" href="/static/favicon.ico" />
|
<link rel="shortcut icon" href="/static/favicon.ico" />
|
||||||
|
|
|
@ -10,128 +10,9 @@
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<body>
|
<body>
|
||||||
<header id="info">
|
{% include "header.html" %}
|
||||||
<div id="title-wrapper" class="column">
|
{% include "main.html" %}
|
||||||
<h1 id="title">BVplan</h1>
|
{% include "footer.html" %}
|
||||||
<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 <<a
|
|
||||||
href="mailto:dominic@dergrimm.net"
|
|
||||||
>dominic@dergrimm.net</a
|
|
||||||
>>, Untis sucks
|
|
||||||
</code>
|
|
||||||
</p>
|
|
||||||
</footer>
|
|
||||||
|
|
||||||
<script src="/static/js/bvplan.js"></script>
|
<script src="/static/js/bvplan.js"></script>
|
||||||
<script>
|
<script>
|
||||||
|
|
|
@ -10,128 +10,9 @@
|
||||||
|
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<body class="display">
|
<body class="display">
|
||||||
<header id="info">
|
{% include "header.html" %}
|
||||||
<div id="title-wrapper" class="column">
|
{% include "main.html" %}
|
||||||
<h1 id="title">BVplan</h1>
|
{% include "footer.html" %}
|
||||||
<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 <<a
|
|
||||||
href="mailto:dominic@dergrimm.net"
|
|
||||||
>dominic@dergrimm.net</a
|
|
||||||
>>, Untis sucks
|
|
||||||
</code>
|
|
||||||
</p>
|
|
||||||
</footer>
|
|
||||||
|
|
||||||
<script src="/static/js/bvplan.js"></script>
|
<script src="/static/js/bvplan.js"></script>
|
||||||
<script>
|
<script>
|
||||||
|
|
21
bvplan/templates/footer.html
Normal file
21
bvplan/templates/footer.html
Normal 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 <<a
|
||||||
|
href="mailto:dominic@dergrimm.net"
|
||||||
|
>dominic@dergrimm.net</a
|
||||||
|
>>, Untis' APIs suck
|
||||||
|
</code>
|
||||||
|
</p>
|
||||||
|
</footer>
|
13
bvplan/templates/header.html
Normal file
13
bvplan/templates/header.html
Normal 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>
|
85
bvplan/templates/main.html
Normal file
85
bvplan/templates/main.html
Normal 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>
|
|
@ -99,5 +99,3 @@ volumes:
|
||||||
db:
|
db:
|
||||||
rabbitmq:
|
rabbitmq:
|
||||||
redis:
|
redis:
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue