mirror of
https://github.com/almet/notmyidea.git
synced 2025-04-28 11:32:39 +02:00
english worklog
This commit is contained in:
parent
6ca02e7af5
commit
d749105e34
1 changed files with 94 additions and 0 deletions
94
mnmlist/templates/worklog-en.html
Normal file
94
mnmlist/templates/worklog-en.html
Normal file
|
@ -0,0 +1,94 @@
|
|||
{% extends "page.html" %}
|
||||
{% block extra_head %}
|
||||
<script src="https://cdn.jsdelivr.net/npm/vega@5"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/vega-lite@5"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/vega-embed@6"></script>
|
||||
{% endblock extra_head %}
|
||||
{% block content %}
|
||||
<header>
|
||||
<h1 class="post-title">{{ page.title }}</h1>
|
||||
<details>
|
||||
<summary>Stats</summary>
|
||||
{% if "total_days" in page.metadata.keys() %}
|
||||
{% set percentage = page.metadata.worklog['percentage'] %}
|
||||
{% set total_blocks = 10 %}
|
||||
{% set percentage_value = (percentage / 100.0) %}
|
||||
{% set full_blocks = ((percentage_value * total_blocks) | round(0, 'floor') ) | int %}
|
||||
{% set empty_blocks = total_blocks - full_blocks %}
|
||||
<div>
|
||||
{# Display full blocks #}
|
||||
{% for i in range(full_blocks) %}▓{% endfor %}
|
||||
{# Display empty blocks #}
|
||||
{% for i in range(empty_blocks) %}░{% endfor %}
|
||||
{{ percentage }}% ({{ page.metadata.worklog['payed_hours'] }}h / {{ page.metadata.worklog['total_hours'] }} prévues)
|
||||
</div>
|
||||
<ul>
|
||||
<li>{{ page.metadata.worklog['payed_hours'] }}h</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Month</td>
|
||||
<td>Days</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for month, hours in page.metadata.worklog.monthly_hours.items() %}
|
||||
<tr>
|
||||
<td>{{ month }}</td>
|
||||
<td>{{ (hours['payed'] / 7.0) | round(1) }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</details>
|
||||
</header>
|
||||
<article>
|
||||
<div id="vis"></div>
|
||||
{{ page.content }}
|
||||
</article>
|
||||
<script>
|
||||
const spec = {
|
||||
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
|
||||
"width": 500,
|
||||
"height": 200,
|
||||
"data":
|
||||
{
|
||||
"name": "table",
|
||||
"values": [
|
||||
{% for date, item in page.metadata.worklog.data.items() %}
|
||||
{"date": "{{ date }}", "series": "Worked", "count": {{ item['payed_hours'] }}},
|
||||
{% endfor %}
|
||||
]
|
||||
}
|
||||
,
|
||||
"mark": "bar",
|
||||
"encoding": {
|
||||
"x": {
|
||||
"timeUnit": {"unit": "", "utc": true},
|
||||
"field": "date",
|
||||
"axis": {"format": "%d/%m"},
|
||||
"title": "Date"
|
||||
},
|
||||
"y": {
|
||||
"aggregate": "sum",
|
||||
"field": "count",
|
||||
"title": "Hours",
|
||||
},
|
||||
"color": {
|
||||
"field": "series",
|
||||
"scale": {
|
||||
"domain": ["Worked"],
|
||||
"range": ["#1f77b4"]
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
vegaEmbed("#vis", spec)
|
||||
// result.view provides access to the Vega View API
|
||||
.then(result => console.log(result))
|
||||
.catch(console.warn);
|
||||
</script>
|
||||
{% endblock content %}
|
Loading…
Reference in a new issue