mirror of
https://github.com/YGGverse/nexy.git
synced 2026-03-31 17:25:27 +00:00
implement visitors count macro for each directory index
This commit is contained in:
parent
450bbe60f3
commit
56830be4a9
7 changed files with 35 additions and 19 deletions
|
|
@ -37,15 +37,22 @@ impl Request {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn total(&self) -> usize {
|
||||
pub fn total(&self, query_prefix: Option<&str>) -> usize {
|
||||
let mut t = 0;
|
||||
if let Some(ref this) = self.0 {
|
||||
let mut t = 0;
|
||||
for c in this.read().unwrap().values() {
|
||||
t += c.len()
|
||||
for queries in this.read().unwrap().values() {
|
||||
match query_prefix {
|
||||
Some(p) => {
|
||||
for q in queries {
|
||||
if q.value.starts_with(p) {
|
||||
t += 1
|
||||
}
|
||||
}
|
||||
}
|
||||
None => t += queries.len(),
|
||||
}
|
||||
}
|
||||
t
|
||||
} else {
|
||||
0
|
||||
}
|
||||
t
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue