Compare commits

...

2 Commits

Author SHA1 Message Date
c4a9a541d3 Merge pull request 'don't show external boats in boatstat; hide logout in menu; move owner into own column in boatstat' (#369) from updates into main
Some checks failed
CI/CD Pipeline / deploy-staging (push) Blocked by required conditions
CI/CD Pipeline / deploy-main (push) Blocked by required conditions
CI/CD Pipeline / test (push) Has been cancelled
Reviewed-on: #369
2024-04-14 21:40:27 +02:00
7ebbf5661a don't show external boats in boatstat; hide logout in menu; move owner into own column in boatstat
Some checks failed
CI/CD Pipeline / test (push) Has been cancelled
CI/CD Pipeline / deploy-staging (push) Has been cancelled
CI/CD Pipeline / deploy-main (push) Has been cancelled
2024-04-14 20:20:22 +02:00
3 changed files with 24 additions and 39 deletions

View File

@ -17,6 +17,7 @@ pub struct BoatStat {
pub struct SingleBoatStat {
name: String,
location: String,
owner: String,
years: HashMap<String, i32>,
}
@ -39,7 +40,7 @@ LEFT JOIN
LEFT JOIN
location ON boat.location_id = location.id
WHERE
boat.name != 'Externes Boot'
boat.name != 'Externes Boot' AND not boat.external
GROUP BY
boat.id, year
ORDER BY
@ -58,7 +59,7 @@ ORDER BY
} else {
String::from("Verein")
};
let name = format!("{} ({})", boat.name, owner);
let name = boat.name.clone();
let location: String = row.get("location");
let year: i32 = row.get("year");
if year == 0 {
@ -78,6 +79,7 @@ ORDER BY
.or_insert(SingleBoatStat {
name,
location,
owner,
years: HashMap::new(),
});
boat_stat.years.insert(year, rowed_km);

View File

@ -34,23 +34,6 @@
</a>
</div>
<div>
{% if "scheckbuch" in loggedin_user.roles and loggedin_user.weight and loggedin_user.sex and loggedin_user.dob %}
<a href="#"
class="inline-flex justify-center rounded-md bg-primary-600 mx-1 px-3 py-2 text-sm font-semibold text-white hover:bg-primary-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 cursor-pointer"
data-sidebar="true"
data-trigger="sidebar"
data-header="Ergo Challenge"
data-body="#mobile-menu-guest">
{% include "includes/book" %}
<span class="sr-only">Ergo</span>
</a>
<div class="hidden">
<div id="mobile-menu-guest">
<a href="/ergo" class="block w-100 py-2 hover:text-primary-600 border-t">Ergo</a>
</div>
</div>
{% endif %}
{% if "scheckbuch" not in loggedin_user.roles %}
<a href="#"
class="inline-flex justify-center rounded-md bg-primary-600 mx-1 px-3 py-2 text-sm font-semibold text-white hover:bg-primary-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 cursor-pointer"
data-sidebar="true"
@ -62,34 +45,32 @@
</a>
<div class="hidden">
<div id="mobile-menu">
{% if "Donau Linz" in loggedin_user.roles %}
<a href="/planned" class="block w-100 py-2 hover:text-primary-600">Geplante Ausfahrten</a>
<a href="/log" class="block w-100 py-2 hover:text-primary-600 border-t">Ausfahrt eintragen</a>
<a href="/log/show"
class="block w-100 py-2 hover:text-primary-600 border-t">Logbuch</a>
{% if "admin" in loggedin_user.roles or "Vorstand" in loggedin_user.roles %}
<a href="/admin/user"
class="block w-100 py-2 hover:text-primary-600 border-t">Userverwaltung</a>
{% endif %}
{% if loggedin_user.weight and loggedin_user.sex and loggedin_user.dob %}
<a href="/ergo" class="block w-100 py-2 hover:text-primary-600 border-t">Ergo</a>
{% endif %}
<a href="/stat" class="block w-100 py-2 hover:text-primary-600 border-t">Statistik</a>
<a href="/stat/boats"
class="block w-100 py-2 hover:text-primary-600 border-t">Bootsauswertung</a>
{% if "admin" in loggedin_user.roles %}
<a href="/admin/boat"
class="block w-100 py-2 hover:text-primary-600 border-t">Boote</a>
{% endif %}
<a href="/boatdamage"
class="block w-100 py-2 hover:text-primary-600 border-t">Bootsschaden</a>
<a href="/boatreservation"
class="block w-100 py-2 hover:text-primary-600 border-t">Bootsreservierung</a>
</div>
</div>
{% endif %}
<a href="/auth/logout"
class="inline-flex justify-center rounded-md bg-gray-200 ml-1 px-3 py-2 text-sm font-semibold text-primary-950 hover:bg-gray-300 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary-600 cursor-pointer">
<svg class="inline h-4"
{% endif %}
{% if loggedin_user.weight and loggedin_user.sex and loggedin_user.dob %}
<a href="/ergo" class="block w-100 py-2 hover:text-primary-600 border-t">Ergo</a>
{% endif %}
{% if "admin" in loggedin_user.roles or "Vorstand" in loggedin_user.roles %}
<a href="/admin/user"
class="block w-100 py-2 hover:text-primary-600 border-t">Userverwaltung</a>
{% endif %}
{% if "admin" in loggedin_user.roles %}
<a href="/admin/boat"
class="block w-100 py-2 hover:text-primary-600 border-t">Boote</a>
{% endif %}
<a href="/auth/logout"
class="block w-100 py-2 hover:text-primary-600 border-t">Ausloggen<svg class="inline h-4"
width="24"
height="24"
viewbox="0 0 24 24"
@ -102,9 +83,9 @@
<path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path>
<polyline points="16 17 21 12 16 7"></polyline>
<line x1="21" y1="12" x2="9" y2="12"></line>
</svg>
<span class="sr-only">Ausloggen</span>
</a>
</svg></a>
</div>
</div>
</div>
</div>
</header>

View File

@ -9,6 +9,7 @@
<thead>
<tr>
<th>Name</th>
<th>Eigentümer</th>
<th>Ort</th>
{% for year in stat.pot_years | sort | reverse %}<th>{{ year }}</th>{% endfor %}
</tr>
@ -17,6 +18,7 @@
{% for boat in stat.boats %}
<tr>
<td>{{ boat.name }}</td>
<td>{{ boat.owner }}</td>
<td>{{ boat.location }}</td>
{% for year in stat.pot_years | sort | reverse %}
<td>