force-h2020 / force-wfmanager

Workflow manager: UI application for Business Decision System
Other
1 stars 0 forks source link

switch if length of data set rather than data #373

Closed sparsonslab closed 4 years ago

sparsonslab commented 4 years ago

Closes #369. Length of set is calculated before if-else ladder, as otherwise set would have to be called twice on a long list with a set size of 1.

codecov[bot] commented 4 years ago

Codecov Report

Merging #373 into master will increase coverage by 0.00%. The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #373   +/-   ##
=======================================
  Coverage   96.71%   96.71%           
=======================================
  Files          49       49           
  Lines        2647     2648    +1     
  Branches      339      339           
=======================================
+ Hits         2560     2561    +1     
  Misses         51       51           
  Partials       36       36           
Impacted Files Coverage Δ
force_wfmanager/ui/review/plot.py 94.84% <100.00%> (+0.02%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 01c0c70...044fe04. Read the comment docs.

flongford commented 4 years ago

... excuse me forgot the commit comment. Now we don't need to use the set operation. Just check the equality of the first two elements (if len > 1)

I'm not sure this would still work if other elements in the list possessed the same value. Is there any preference for not using set here?

sparsonslab commented 4 years ago

... excuse me forgot the commit comment. Now we don't need to use the set operation. Just check the equality of the first two elements (if len > 1)

I'm not sure this would still work if other elements in the list had the possessed the same value. Is there any preference for not using set here?

I think I see.

flongford commented 4 years ago

... excuse me forgot the commit comment. Now we don't need to use the set operation. Just check the equality of the first two elements (if len > 1)

I'm not sure this would still work if other elements in the list had the possessed the same value. Is there any preference for not using set here?

I think I see.

Now I'm questioning my logic - hang on, you might have been right previously.... The bug only occurs when ALL the elements are the same, right? I think I was confusing myself with sets containing unique values

sparsonslab commented 4 years ago

... excuse me forgot the commit comment. Now we don't need to use the set operation. Just check the equality of the first two elements (if len > 1)

I'm not sure this would still work if other elements in the list had the possessed the same value. Is there any preference for not using set here?

I think I see.

Now I'm questioning my logic - hang on, you might have been right previously....

No, you're right. My code would have failed with e.g. data = [1, 1, 0]

flongford commented 4 years ago

... excuse me forgot the commit comment. Now we don't need to use the set operation. Just check the equality of the first two elements (if len > 1)

I'm not sure this would still work if other elements in the list had the possessed the same value. Is there any preference for not using set here?

I think I see.

Now I'm questioning my logic - hang on, you might have been right previously....

No, you're right. My code would have failed with e.g. data = [1, 1, 0]

Right, yes that makes sense - phew, got there in the end