Bw/bar graphs #1121

Open
wants to merge 39 commits into
from

Projects

None yet

6 participants

@Br3nda
Contributor
Br3nda commented Dec 6, 2016

I think PR #688 is awesome, so here is it with the merge conflicts fixed.

Marlena and others added some commits Sep 11, 2014
@Marlena Marlena Merge remote-tracking branch 'origin/dev' 80532e9
@Marlena Marlena Merge remote-tracking branch 'upstream/master' 994ee18
@Marlena Marlena committing tests classes I thought I committed earlier :/ d4d76b2
@Marlena Marlena changed growtuff to growstuff which fixed tests 8826b01
@Marlena Marlena barlabelgroup tests passing still horizontalbargraph tests to fix cc22b87
@Marlena Marlena bar label group and all tests passing 482650d
@Marlena Marlena BarGroup uses data object dbbd37e
@Marlena Marlena add names to contributors f608685
@Marlena Marlena fix conflict in contributors file 5f435b1
@Marlena Marlena add group for graph and transform to accommodate labels e52c4f7
@Marlena Marlena xscale working 1a845fd
@Marlena Marlena fixing tests but some of them are green and render is working 6d8817d
@Marlena Marlena all tests working but 2 about to monkey with data again a749a9c
@Marlena Marlena all but one test passing and seeing that I need a how separate y scale 1d5466f
@Marlena Marlena all tests by the y test is passing e3d2a90
@Marlena Marlena added chart to the page 73e1442
@Marlena Marlena all charts tests passing WOOT ba7ef3c
@Marlena Marlena add bits to get the labels in the right place a013385
@Marlena Marlena merge in changes from dev branch 39feeb9
@Marlena Marlena fix merge conflicts in gemfile.lock 567562f
@Marlena Marlena add tooltip to show data values 66b0f13
@Marlena Marlena change color when hovering over a bar 6e4bb58
@Marlena Marlena add h2 for sunniness chart and crop map b0a803a
@Marlena Marlena refactored graph scale into width scale and height scale a48a6da
@Marlena Marlena move bar color into the data 5a1fd19
@Marlena Marlena write test for tooltips c7a7138
@Marlena Marlena add comments explaining each file per pull request 71c0bff
@Br3nda Br3nda Merge remote-tracking branch 'upstream/dev' into bw/bar_graphs
 Conflicts:
	CONTRIBUTORS.md
	Gemfile
	Gemfile.lock
	app/assets/javascripts/application.js
	app/assets/javascripts/crops.js.erb
	app/views/crops/show.html.haml
6e0e7e4
@maco maco added the in progress label Dec 6, 2016
Br3nda and others added some commits Dec 6, 2016
@Br3nda Br3nda Fix up css style
0f15095
@Br3nda Br3nda Move the invocation into the parens that contain the function
d68cfe0
@Br3nda Br3nda Code style fix up (comments only)
af42410
@Br3nda Br3nda Eslint clean ups
a23e241
@Br3nda Br3nda Removed duplicate variable assignment
d4a496e
@CloCkWeRX CloCkWeRX Merge branch 'dev' into bw/bar_graphs
a074e72
@Br3nda Br3nda Merge branch 'dev' into bw/bar_graphs
8161e90
@coveralls
coveralls commented Dec 7, 2016 edited

Coverage Status

Coverage remained the same at 87.765% when pulling 8161e90 on Br3nda:bw/bar_graphs into aea935b on Growstuff:dev.

@CloCkWeRX
Contributor
CloCkWeRX commented Dec 8, 2016 edited

Color literals like #ffa500 should only be used in variable declarations; they should be referred to via variable everywhere else.

I don't think that's used anywhere else (its... orange); though we do have

$beige: #f3f1ee
$brown: #413f3b

$green:  #5f8e43
$blue:   #2f4365
$red:    #8e4d43
$orange: #b2685c
$yellow: #b2935c

Weirdly; #b2685c is completely not orange. I didn't quite see where it was used in the UI looking at the code only

@CloCkWeRX
Contributor

I think with the d3 'similar code', its just going to be something we ignore. Specifically:

Similar code found in 1 other location (mass = 73)
NEW
    return d3.append('g')
      .attr("class", "bar-label")
      .selectAll("text")
      .data(bars.map(function(bar){ return bar.name;}))
      .enter()
To ignore this duplication issue modify your .codeclimate.yml file and add 16dbcb58d6caa7ccfe241417831ecfa6 to exclude_fingerprints. An example is shown below.

.codeclimate.yml
engines:
  # ... CONFIG CONTENT ...
  duplication:
    enabled: true
    # ... CONFIG CONTENT ...
    exclude_fingerprints:
    - 16dbcb58d6caa7ccfe241417831ecfa6
# ... CONFIG CONTENT ...
@CloCkWeRX
Contributor
for (i; i < data.bars.length; i++){
      barValues.push(data.bars[i].value)
    }

Kind of keen to see if we can barValues.push(data.bars.map(function(bar) { return bar.value; });

@@ -0,0 +1,124 @@
+# src_files
@CloCkWeRX
CloCkWeRX Dec 8, 2016 Contributor

I wonder if spec/javascript will execute in travis automagically, or if we have to invoke something else.

Generally like jasmine for complex JS testing

@pozorvlak
pozorvlak Dec 8, 2016 Member

That would be awesome, but it's not the end of the world if we add another line to .travis.yml.

In general, I'm +10000 to us adding JavaScript unit tests via some means, and I'm not too bothered about which framework we use.

@CloCkWeRX
CloCkWeRX Dec 9, 2016 Contributor

Let's make #1125 also be 'make js tests work in travis'

@pozorvlak
pozorvlak Dec 20, 2016 Member

It doesn't look like the tests are being run in Travis; if I run rspec spec/javascripts locally I get 0 tests executed. @Br3nda, how are you invoking the tests locally?

@CloCkWeRX

Once we knock off the code climate complaints, I'm pretty happy with this.

Afterwards, lets make sure jasmine runs in travis by default.

In the original PR, it talked about connecting this up to "real data"; so let's focus on that in subsequent tickets.

In the original PR, @cesy I think was curious about how it worked for screenreaders - the default answer is "it doesn't work" for now, but lets investigate that more.

Br3nda added some commits Dec 8, 2016
@Br3nda Br3nda Merge branch 'dev' into bw/bar_graphs
391d5be
@Br3nda Br3nda Merge branch 'dev' into bw/bar_graphs
fe5a931
@coveralls

Coverage Status

Coverage remained the same at 88.39% when pulling fe5a931 on Br3nda:bw/bar_graphs into 3e43a19 on Growstuff:dev.

@coveralls

Coverage Status

Coverage remained the same at 88.39% when pulling fe5a931 on Br3nda:bw/bar_graphs into 3e43a19 on Growstuff:dev.

@Br3nda
Contributor
Br3nda commented Dec 15, 2016

Css isn't my thing. Anyone who can quickly work out how to appease code climate?

@Br3nda Br3nda Merge branch 'dev' into bw/bar_graphs
27520e9
@coveralls

Coverage Status

Coverage remained the same at 88.39% when pulling 27520e9 on Br3nda:bw/bar_graphs into 148dfa7 on Growstuff:dev.

@coveralls

Coverage Status

Coverage remained the same at 88.39% when pulling 27520e9 on Br3nda:bw/bar_graphs into 148dfa7 on Growstuff:dev.

@pozorvlak
Member

The one-line duplication between bar_group.js and width_scale.js looks trivial, but actually it's one identical line embedded in two functions which are logically identical but just different enough to fool CodeClimate. So it would be good to factor that out. The function in question boils down to bars.map(function(bar) { return bar.value; }), which I see you're using in the other "similar code found" issue - can we rely on the map method existing?

The "similar code found between bar_group.js and bar_label_group.js" issue looks like a false positive to me - sure, we could factor out some common code, but the similarity is superficial so we wouldn't gain anything thereby. To ignore it, add 16dbcb58d6caa7ccfe241417831ecfa6 to engines.duplication.exclude_fingerprints in .codeclimate.yml, as follows:

engines:
  # ... CONFIG CONTENT ...
  duplication:
    enabled: true
    # ... CONFIG CONTENT ...
    exclude_fingerprints:
    - 16dbcb58d6caa7ccfe241417831ecfa6
# ... CONFIG CONTENT ...
@pozorvlak
Member

Oh, @CloCkWeRX already said everything I did a fortnight ago. D'oh. Oh well, at least I'm somewhat up to speed with the issues now.

@CloCkWeRX
Contributor
CloCkWeRX commented Dec 20, 2016 edited
@Br3nda Br3nda Merge branch 'dev' into bw/bar_graphs
0c8345d
@coveralls

Coverage Status

Coverage remained the same at 89.006% when pulling 0c8345d on Br3nda:bw/bar_graphs into 58ddeef on Growstuff:dev.

@coveralls

Coverage Status

Coverage remained the same at 89.006% when pulling 0c8345d on Br3nda:bw/bar_graphs into 58ddeef on Growstuff:dev.

@pozorvlak
Member

We can use jQuery.map: we're already using jQuery.

@pozorvlak pozorvlak referenced this pull request Dec 22, 2016
Open

Refactor test-runners #1133

10 of 10 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment