Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Narratives bug #736

Merged
merged 9 commits into from
Jul 9, 2019
Merged

Narratives bug #736

merged 9 commits into from
Jul 9, 2019

Commits on Jul 9, 2019

  1. Map helpers: refactor updateOnMoveEnd

    Because the `updateOnMoveEnd` function only runs
    code inside the conditional `if (d3elems) {}`, refactor
    to create a `if (!d3elems) {}` guard statements and
    unindent the code within the function.
    kairstenfay authored and jameshadfield committed Jul 9, 2019
    Configuration menu
    Copy the full SHA
    eeebdb6 View commit details
    Browse the repository at this point in the history
  2. Map: fix haveData bug

    In `maybeUpdateDemesAndTransmissions()`, the
    variable `haveData` was not always a boolean as
    was seemingly intended by its naming and usage.
    Change one of the values in its declaration to
    evaluate to a boolean by prefixing `!!`. 
    
    Now `!!nextProps.nodeColors` evaluates to `true`
    or `false` instead of a list or `false`.
    kairstenfay authored and jameshadfield committed Jul 9, 2019
    Configuration menu
    Copy the full SHA
    26b26fc View commit details
    Browse the repository at this point in the history
  3. Map: refactor maybeUpdateDemesAndTransmissions

    Previously, in the function `maybeUpdateDemesAndTransmissions()` (part
    of the Map component), there was a large, indented code block inside of
    a conditional checking for truthiness in `colorOrVisibilityChange &&
    haveData`. Because changes only occurred if this conditional was true,
    refactor it so that the conditional is now a guard statement. If the
    conditional evaluates to false, exit the function. Now the bulk of the
    code is not indented.
    kairstenfay authored and jameshadfield committed Jul 9, 2019
    Configuration menu
    Copy the full SHA
    8aa787d View commit details
    Browse the repository at this point in the history
  4. Map helpers: refactor setupTransmissionData

    Reduce the level of indendation of the bulk of the code in the function
    `setupTransmissionData` by refactoring two of the conditional checks
    into guard statements.
    
    This change reduces the cognitive load required to read and understand
    this function.
    kairstenfay authored and jameshadfield committed Jul 9, 2019
    Configuration menu
    Copy the full SHA
    607c977 View commit details
    Browse the repository at this point in the history
  5. Map helpers: refactor setupDemeData

    Refactor the function `setupDemeData` for better readability by
    reducing the level of indentation of the code. This commit converts two
    conditional checks into guard statements that exit the `forEach` loop
    if each condition is not met.
    
    Also removes an explicit `boolean === true` check in favor of `boolean`.
    kairstenfay authored and jameshadfield committed Jul 9, 2019
    Configuration menu
    Copy the full SHA
    b8614a5 View commit details
    Browse the repository at this point in the history
  6. Map: refactor maybeDrawDemesAndTransmissions

    Shorten a conditional by casting the string to lower case.
    kairstenfay authored and jameshadfield committed Jul 9, 2019
    Configuration menu
    Copy the full SHA
    1f808b4 View commit details
    Browse the repository at this point in the history
  7. Map helpers: refactor updateTransmissionDataCol...

    Refactor the `updateTransmissionDataColAndVis` function to reduce the
    level of indendation of the code. Convert the conditional checks to
    guard statements that exist the `forEach` loop if the condition is not
    met.
    kairstenfay authored and jameshadfield committed Jul 9, 2019
    Configuration menu
    Copy the full SHA
    714b487 View commit details
    Browse the repository at this point in the history
  8. Map helpers: log updateVisibility error

    Logs an error in the function `updateVisibility' if
    `d3elems` is undefined.
    
    Co-authored-by: James Hadfield <jhadfiel@fredhutch.org>
    kairstenfay and jameshadfield committed Jul 9, 2019
    Configuration menu
    Copy the full SHA
    a307d1c View commit details
    Browse the repository at this point in the history
  9. Map: fix bug re: geo resolution changes. Closes #722

    Previously, when the geo resolution would change,
    `drawDemesAndTransmissions` would not
    necessarily be called, often causing data on the map
    to not load at all between queries.
    
    James also did some work here to correct the deme
    and transmission data that were being loaded on
    each narrative page change.
    
    This commit further complicates the map code, but is
    necessary to fix this bug. It is a prime candidate
    for refactoring in #735
    
    Co-authored-by: James Hadfield <jh22@sanger.ac.uk>
    Co-authored-by: Jover Lee <joverlee521@gmail.com>
    3 people committed Jul 9, 2019
    Configuration menu
    Copy the full SHA
    30299e5 View commit details
    Browse the repository at this point in the history