Skip to content

fixed an inconsistency in the template counts for the usage dashboard - #2392

Merged
briri merged 1 commit into
developmentfrom
bug/usage_dashboard_template_counts
Feb 11, 2020
Merged

fixed an inconsistency in the template counts for the usage dashboard#2392
briri merged 1 commit into
developmentfrom
bug/usage_dashboard_template_counts

Conversation

@xsrust

@xsrust xsrust commented Feb 11, 2020

Copy link
Copy Markdown
Contributor

After some digging, it turned out the inconsistency was twofold.

First, when generating the statistics objects, we organise the templates by their family_id but we save the stats objects by template.title. This means when both customized and non-customized versions of a template are used within an organisation, we save two separate counts, with the same name, ex:

{"count"=>8,
  "date"=>"2019-05-31",
  "by_template"=>
   [{"name"=>"BBSRC Template", "count"=>1},
    {"name"=>"EPSRC Data Management Plan", "count"=>1},
    {"name"=>"University of Manchester Generic Template", "count"=>3},
    {"name"=>"Wellcome Trust Template", "count"=>1},
    {"name"=>"Wellcome Trust Template", "count"=>1},
    {"name"=>"TEST New funder template", "count"=>1}]},

Then, when we're re-martialing the data for the plans_by_template chart, we iterate, identifying the different templates by name, and thus over-write the data with the last count.

It might be worthwile to adjust the way we save the statistics to differentiate between raw and customized funder templates, but for the meantime, I adjusted the template-chart helper to just add the counts when it encounters duplicate entries.

@xsrust

xsrust commented Feb 11, 2020

Copy link
Copy Markdown
Contributor Author

Addresses #2083

@briri briri left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great catch! Thanks for digging into this @xsrust

@briri
briri merged commit e3df623 into development Feb 11, 2020
@briri
briri deleted the bug/usage_dashboard_template_counts branch April 28, 2020 14:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants