Merge pull request 'don't show external boats in boatstat; hide logout in menu; move owner into own column in boatstat' (#368) from updates into staging
Some checks are pending
CI/CD Pipeline / test (push) Waiting to run
CI/CD Pipeline / deploy-staging (push) Blocked by required conditions
CI/CD Pipeline / deploy-main (push) Blocked by required conditions

Reviewed-on: #368
This commit is contained in:
philipp 2024-04-14 20:22:18 +02:00
commit a1b78db750
3 changed files with 24 additions and 39 deletions

View File

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

View File

@ -34,23 +34,6 @@
</a> </a>
</div> </div>
<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="#" <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" 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-sidebar="true"
@ -62,34 +45,32 @@
</a> </a>
<div class="hidden"> <div class="hidden">
<div id="mobile-menu"> <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="/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" class="block w-100 py-2 hover:text-primary-600 border-t">Ausfahrt eintragen</a>
<a href="/log/show" <a href="/log/show"
class="block w-100 py-2 hover:text-primary-600 border-t">Logbuch</a> 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" class="block w-100 py-2 hover:text-primary-600 border-t">Statistik</a>
<a href="/stat/boats" <a href="/stat/boats"
class="block w-100 py-2 hover:text-primary-600 border-t">Bootsauswertung</a> 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" <a href="/boatdamage"
class="block w-100 py-2 hover:text-primary-600 border-t">Bootsschaden</a> class="block w-100 py-2 hover:text-primary-600 border-t">Bootsschaden</a>
<a href="/boatreservation" <a href="/boatreservation"
class="block w-100 py-2 hover:text-primary-600 border-t">Bootsreservierung</a> class="block w-100 py-2 hover:text-primary-600 border-t">Bootsreservierung</a>
</div> {% endif %}
</div> {% if loggedin_user.weight and loggedin_user.sex and loggedin_user.dob %}
{% endif %} <a href="/ergo" class="block w-100 py-2 hover:text-primary-600 border-t">Ergo</a>
<a href="/auth/logout" {% endif %}
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"> {% if "admin" in loggedin_user.roles or "Vorstand" in loggedin_user.roles %}
<svg class="inline h-4" <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" width="24"
height="24" height="24"
viewbox="0 0 24 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> <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> <polyline points="16 17 21 12 16 7"></polyline>
<line x1="21" y1="12" x2="9" y2="12"></line> <line x1="21" y1="12" x2="9" y2="12"></line>
</svg> </svg></a>
<span class="sr-only">Ausloggen</span> </div>
</a> </div>
</div> </div>
</div> </div>
</header> </header>

View File

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