osuosl / fenestra

A dashboard displaying stats about the OSU Open Source Lab
Apache License 2.0
2 stars 3 forks source link

Fix rounding on TimeSync user list. #54

Closed MorganEPatch closed 7 years ago

MorganEPatch commented 7 years ago

Fixes bug leftover from #53. Somehow I failed to catch this before I merged that PR.

Changes in this PR.

As it turns out, if you take the key-value pair of a Hash in an each call, you can modify it (as we were doing), but if you take the key and the value separately, modifications don't stick around.

That is:

dict = {a: 1, b: 2, c: 3}
dict.each do |pair|
    pair[0] = pair[0] + 'z'
    pair[1] = pair[1] + 3
end

Will properly result in {az: 4, bz: 5, cz: 6}, whereas:

dict = {a: 1, b: 2, c: 3}
dict.each do |key, val|
    key = key + 'z'
    val = val + 3
end

Will result in no changes to the Hash whatsoever.

Testing this PR.

  1. Run fenestra.

Expected Output.

See the user time list properly round the times, rather than leave a Float.

@osuosl/devs