Merge pull request 'Merge pull request 'force an action on important notifications' (#1177) from force-action-on-important-notifications into main' (#1178) from new-sort-option into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 17m44s
CI/CD Pipeline / deploy-staging (push) Successful in 7m49s
CI/CD Pipeline / deploy-main (push) Has been skipped

Reviewed-on: #1178
This commit was merged in pull request #1178.
This commit is contained in:
2026-01-05 13:09:12 +01:00
2 changed files with 16 additions and 1 deletions

View File

@@ -361,6 +361,13 @@ WHERE lower(name)=lower(?)
}
pub async fn all_with_order(db: &SqlitePool, sort: &str, asc: bool) -> Vec<Self> {
let allowed_sort_columns = ["last_access", "name", "member_since_date"];
let sort_column = if allowed_sort_columns.contains(&sort) {
sort
} else {
"last_access"
};
let mut query = format!(
"
SELECT id, name, pw, deleted, last_access, dob, weight, sex, member_since_date, birthdate, mail, nickname, phone, address, family_id, user_token
@@ -368,7 +375,7 @@ WHERE lower(name)=lower(?)
WHERE deleted = 0
ORDER BY {}
",
sort
sort_column
);
if !asc {
query.push_str(" DESC");

View File

@@ -163,6 +163,14 @@
<a href="?sort=name"
class="block px-4 py-2 hover:bg-gray-100 hover:text-secondary-950">Name Z-A</a>
</li>
<li>
<a href="?sort=member_since_date&asc"
class="block px-4 py-2 hover:bg-gray-100 hover:text-secondary-950">Mitglied seit (älteste)</a>
</li>
<li>
<a href="?sort=member_since_date"
class="block px-4 py-2 hover:bg-gray-100 hover:text-secondary-950">Mitglied seit (neueste)</a>
</li>
</ul>
</div>
</div>