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
Reviewed-on: #1178
This commit was merged in pull request #1178.
This commit is contained in:
@@ -361,6 +361,13 @@ WHERE lower(name)=lower(?)
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub async fn all_with_order(db: &SqlitePool, sort: &str, asc: bool) -> Vec<Self> {
|
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!(
|
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
|
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
|
WHERE deleted = 0
|
||||||
ORDER BY {}
|
ORDER BY {}
|
||||||
",
|
",
|
||||||
sort
|
sort_column
|
||||||
);
|
);
|
||||||
if !asc {
|
if !asc {
|
||||||
query.push_str(" DESC");
|
query.push_str(" DESC");
|
||||||
|
|||||||
@@ -163,6 +163,14 @@
|
|||||||
<a href="?sort=name"
|
<a href="?sort=name"
|
||||||
class="block px-4 py-2 hover:bg-gray-100 hover:text-secondary-950">Name Z-A</a>
|
class="block px-4 py-2 hover:bg-gray-100 hover:text-secondary-950">Name Z-A</a>
|
||||||
</li>
|
</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>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user