Skip to content

Commit

Permalink
Fix years graph not showing both non/refereed
Browse files Browse the repository at this point in the history
yearMap was overwriting entries each time, this makes sure to merge the
existing entry, so no overwriting is happening
  • Loading branch information
thostetler committed Aug 25, 2021
1 parent f483eb0 commit 08a604d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/js/wraps/graph_tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ define([
pivot.forEach(({ value: yearString, count = 0 }) => {
const year = parseInt(yearString, 10);
yearMap.set(year, {
year,
refereed: 0,
notrefereed: 0,
...yearMap.get(year),
[value]: count,
});
});
Expand Down
8 changes: 4 additions & 4 deletions test/mocha/js/widgets/year_graph_facet_widget.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,17 +303,17 @@ define([
});

it('should process refereed and refereed data into a single array, filling in missing years (with y values of 0), to be used by d3', function() {
var graphData = widget.model.attributes.graphData;
const graphData = widget.model.attributes.graphData;

const expectedResults = [
{ x: 1988, y: 1, refCount: 0 },
{ x: 1989, y: 1, refCount: 1 },
{ x: 1989, y: 2, refCount: 1 },
{ x: 1990, y: 0, refCount: 0 },
{ x: 1991, y: 0, refCount: 0 },
{ x: 1992, y: 2, refCount: 0 },
{ x: 1993, y: 0, refCount: 0 },
{ x: 1994, y: 1, refCount: 0 },
{ x: 1995, y: 2, refCount: 2 },
{ x: 1995, y: 3, refCount: 2 },
{ x: 1996, y: 1, refCount: 0 },
{ x: 1997, y: 1, refCount: 0 },
{ x: 1998, y: 1, refCount: 0 },
Expand All @@ -331,7 +331,7 @@ define([
{ x: 2010, y: 1, refCount: 0 },
{ x: 2011, y: 4, refCount: 0 },
{ x: 2012, y: 2, refCount: 0 },
{ x: 2013, y: 1, refCount: 1 },
{ x: 2013, y: 2, refCount: 1 },
{ x: 2014, y: 2, refCount: 0 },
{ x: 2015, y: 5, refCount: 0 },
{ x: 2016, y: 0, refCount: 0 },
Expand Down

0 comments on commit 08a604d

Please sign in to comment.