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
12 changes: 6 additions & 6 deletions src/gui/app/directives/conditional-effect/conditionDisplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

function getRightSideValueDisplay() {
return $q(async (resolve) => {
if ($ctrl.condition == null || $ctrl.condition.rightSideValue == null || $ctrl.condition.rightSideValue === "") {
if ($ctrl.condition == null || $ctrl.condition.rightSideValue === null || $ctrl.condition.rightSideValue === undefined || $ctrl.condition.rightSideValue === "") {
resolve("[Not Set]");
} else {
const value = await $injector.invoke($ctrl.conditionType.getRightSideValueDisplay, {}, {
Expand All @@ -60,7 +60,7 @@

function getLeftSideValueDisplay() {
return $q(async (resolve) => {
if ($ctrl.condition == null || $ctrl.condition.leftSideValue == null || $ctrl.condition.leftSideValue === "") {
if ($ctrl.condition == null || $ctrl.condition.leftSideValue === null || $ctrl.condition.leftSideValue === undefined || $ctrl.condition.leftSideValue === "") {
resolve("[Not Set]");
} else {
const value = await $injector.invoke($ctrl.conditionType.getLeftSideValueDisplay, {}, {
Expand All @@ -73,19 +73,19 @@

$ctrl.$onInit = function() {
getRightSideValueDisplay().then((value) => {
$ctrl.rightSideValueDisplay = value || "[Not Set]";
$ctrl.rightSideValueDisplay = value !== null && value !== undefined ? value : "[Not Set]";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works just fine. But note that a single value != null check would be sufficient as it only checks null and undefined, it's not a full falsey check (that would catch 0).

});
getLeftSideValueDisplay().then((value) => {
$ctrl.leftSideValueDisplay = value || "[Not Set]";
$ctrl.leftSideValueDisplay = value !== null && value !== undefined ? value : "[Not Set]";
});
};

$ctrl.$onChanges = function() {
getRightSideValueDisplay().then((value) => {
$ctrl.rightSideValueDisplay = value || "[Not Set]";
$ctrl.rightSideValueDisplay = value !== null && value !== undefined ? value : "[Not Set]";
});
getLeftSideValueDisplay().then((value) => {
$ctrl.leftSideValueDisplay = value || "[Not Set]";
$ctrl.leftSideValueDisplay = value !== null && value !== undefined ? value : "[Not Set]";
});
};
}
Expand Down