Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions waltz-ng/client/logical-flow/services/logical-flow-utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ import _ from "lodash";
import {color} from "d3-color";


function pickWorst(ratings = []) {
const sortedByBadness = [ "DISCOURAGED", "SECONDARY", "PRIMARY", "NO_OPINION" ];
function pickWorst(ratings = [], sortedByBadness = [ "DISCOURAGED", "SECONDARY", "PRIMARY", "NO_OPINION" ]) {
const worst = _.find(sortedByBadness, x => _.includes(ratings, x));

return worst || "NO_OPINION";
Expand All @@ -37,7 +36,9 @@ export default [
const flowId = d.data.id;
const flowDecorators = decoratorsByFlowId[flowId] || [];
const ratings = _.map(flowDecorators, "rating");
return pickWorst(ratings);
// note: we can use the domain() because when it is retrieved, it is already sorted by position & name
// -> ref: flow-classification-utils.loadFlowClassificationRatings
return pickWorst(ratings, flowClassificationColors.domain());
};

return {
Expand Down
Loading