aboutsummaryrefslogtreecommitdiff
path: root/src/route.rs
diff options
context:
space:
mode:
authorFuwn <[email protected]>2025-05-27 02:43:36 -0700
committerFuwn <[email protected]>2025-05-27 02:43:36 -0700
commitb8f61569dbede77a3642bb44f6d213df8f4a9e5e (patch)
tree9cc1c1d3f794f99f2fec90c33c67cff1dfa6f43f /src/route.rs
parentbuild(container): Update build steps to remedy over-caching (diff)
downloadlocus-b8f61569dbede77a3642bb44f6d213df8f4a9e5e.tar.xz
locus-b8f61569dbede77a3642bb44f6d213df8f4a9e5e.zip
feat(directory): Sort routes by hits
Diffstat (limited to 'src/route.rs')
-rw-r--r--src/route.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/route.rs b/src/route.rs
index 12cc8f1..171952c 100644
--- a/src/route.rs
+++ b/src/route.rs
@@ -25,7 +25,9 @@ impl Route {
pub fn hits_from(route: &str) -> i32 {
crate::DATABASE.lock().map_or(0, |database| {
- (*database).get::<i32>(if route.is_empty() { "/" } else { route }).unwrap()
+ (*database)
+ .get::<i32>(if route.is_empty() { "/" } else { route })
+ .unwrap_or(0)
})
}