Only include children in total

This commit is contained in:
Erin Power 2020-12-23 14:18:48 +00:00
parent 55b98f3588
commit 34810da843
2 changed files with 7 additions and 2 deletions

View file

@ -89,6 +89,7 @@ macro_rules! supported_formats {
for (language_type, language) in languages.into_iter() {
map.insert(language_type.to_string(), json!(language));
}
map.insert(String::from("Total"), json!(languages.total()));
match *self {

View file

@ -100,8 +100,12 @@ impl Languages {
/// Summary of the Languages struct.
pub fn total(self: &Languages) -> Language {
let mut total = Language::new();
for (_, language) in self {
total += language.summarise();
for (ty, language) in self {
total.comments += language.comments;
total.blanks += language.blanks;
total.code += language.code;
total.inaccurate |= language.inaccurate;
total.children.insert(*ty, language.reports.clone());
}
total
}