Skip to content

Commit

Permalink
Fix visitor timestamps in app_model.rs and rank.html
Browse files Browse the repository at this point in the history
  • Loading branch information
naiba committed Dec 28, 2023
1 parent e667c6e commit ac57706
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/app_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ impl Context {
let mut dist_r = referrer.get(id).unwrap_or(&(0, now_shanghai())).to_owned();
if matches!(v_type, VisitorType::Referrer) && visitor_cache.is_none() {
dist_r.0 += 1;
dist_r.1 = now_shanghai();
referrer.insert(*id, dist_r);
}
drop(referrer);
Expand All @@ -115,6 +116,7 @@ impl Context {
if matches!(v_type, VisitorType::Badge) {
if visitor_cache.is_none() {
dist_uv.0 += 1;
dist_uv.1 = now_shanghai();
uv.insert(*id, dist_uv);
}
notification = true;
Expand Down
6 changes: 4 additions & 2 deletions templates/rank.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ <h2 class="font-size-18 text-center">总排行</h2>
<th scope="col">RV
<p class="d-inline font-size-12 m-0">来访访客</p>
</th>
<th scope="col">最后链入</th>
<th scope="col">最后受访</th>
<th scope="col">加入时间</th>
<th scope="col">最后活跃</th>
</tr>
</thead>
<tbody>
Expand All @@ -34,8 +35,9 @@ <h2 class="font-size-18 text-center">总排行</h2>
</td>
<td>{{ r.rank.unique_visitor }}</td>
<td>{{ r.rank.referrer }}</td>
<td>{{ r.rank.created_at.format("%Y-%m-%d %H:%M:%S") }}</td>
<td>{{ r.rank.latest_referrered_at.format("%Y-%m-%d %H:%M:%S") }}</td>
<td>{{ r.rank.updated_at.format("%Y-%m-%d %H:%M:%S") }}</td>
<td>{{ r.rank.created_at.format("%Y-%m-%d %H:%M:%S") }}</td>
</tr>
{% endfor %}
</tbody>
Expand Down

0 comments on commit ac57706

Please sign in to comment.