feat: limit hosts to 15 in stats query

This commit is contained in:
Anna 2021-10-10 20:34:07 -04:00
parent dd9234af1b
commit b70f29b6a8
4 changed files with 13 additions and 2 deletions

View File

@ -23,7 +23,7 @@
let total = context.dataset.data.reduce((total, next) => total + next);
let percentage = (context.raw / total * 100).toFixed(2);
return `${context.label} (${percentage}%)`;
return `${context.label} (${context.raw}, ${percentage}%)`;
}
}
},
@ -117,7 +117,7 @@
}
makeChart('duties', 'dutiesChart', 'pie', true);
makeChart('hosts', 'hostsChart', 'pie', true);
makeChart('hosts', 'hostsChart', 'pie');
makeChart('hours', 'hoursChart', 'bar');
makeChart('days', 'daysChart', 'bar');
})();

View File

@ -49,6 +49,10 @@ impl Statistics {
format!("{} @ {}", aliases[0].name.text(), world).into()
}
pub fn num_host_listings(&self) -> usize {
self.hosts.iter().map(|info| info.count).sum()
}
}
#[derive(Debug, Clone, Deserialize)]

View File

@ -58,6 +58,9 @@ lazy_static::lazy_static! {
"$sort": {
"count": -1
}
},
{
"$limit": 15
}
],
"hours": [

View File

@ -64,6 +64,10 @@ Remote Party Finder
<td>{{ info.count }}</td>
</tr>
{%- endfor %}
<tr>
<td>Other</td>
<td>{{ stats.num_listings() - stats.num_host_listings() }}</td>
</tr>
</tbody>
</table>
</details>