cave/trend_tag: limit before window to 3 * period
This commit is contained in:
parent
9e17aef13e
commit
5848c48868
|
@ -89,16 +89,17 @@ impl TrendTag {
|
|||
}
|
||||
|
||||
let from = until - period;
|
||||
let not_before = from - 3 * period;
|
||||
let mut before_mentions = 0;
|
||||
let mut before_hours = 0;
|
||||
let mut after_mentions = 0;
|
||||
|
||||
for (hour, mentions) in self.by_hour.iter().cloned() {
|
||||
if hour <= from {
|
||||
if hour > from {
|
||||
after_mentions += mentions;
|
||||
} else if hour > not_before {
|
||||
before_mentions += mentions;
|
||||
before_hours += 1;
|
||||
} else {
|
||||
after_mentions += mentions;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user