porcej / afd-dashboard-server

A Chalk.js based dashboard built for the Alexandria, VA Fire Department.
MIT License
1 stars 0 forks source link

Shift coloring not properly displaying #8

Closed timbellomo closed 5 years ago

timbellomo commented 6 years ago

Observed the shift coloring not evaluating properly or consistently. Refreshing the page re-calculates and properly colors the days with the shift. Perhaps an issue with adding css classes, and there being a conflict after the days roll over. station dashboard shift coloring_209 station dashboard shift coloring_204

timbellomo commented 6 years ago

Yeah, it looks like the classes just get added, but never removed, so they kind of supersede each other:

wx.js, Line 353

    $( wxRoot + " .wx-day-name")
        .html(fdate.format('dddd, MMMM Do YYYY'))
        .addClass(getShift(fdate) + "-shift-outline");

wx.js, Line 385

    $( wxRoot + " .wx-day-name")
        .html(fdate.format('dddd'))
        .addClass(getShift(fdate) + "-shift-outline");

Resultant HTML

<div class="wx-day-name a-shift-outline b-shift-outline">Monday</div>

I'll forego making suggestions on fixes for now. There are a dozen different approaches. You can decide on the best one.

porcej commented 6 years ago

This was fixed in 68a0810b8b63cfb28437768706a83a1ba0994465 by styling the element using the 'data-shift' attribute. Please test this fix and close if resolved.

timbellomo commented 6 years ago

Living dangerously, I cherry-picked the commit. Looks good so far. Will follow up tomorrow to see if it switches properly.

porcej commented 5 years ago

Closed July 2018