From 930f1525b36557b666361606a091f992d3ce8b42 Mon Sep 17 00:00:00 2001 From: Joseph Abbey Date: Sun, 28 Jan 2024 13:59:07 +0000 Subject: [PATCH] Best practices! --- source/BackgroundServiceDelegate.mc | 4 ++-- source/WebhookManager.mc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/BackgroundServiceDelegate.mc b/source/BackgroundServiceDelegate.mc index a783b5f..13e72d8 100644 --- a/source/BackgroundServiceDelegate.mc +++ b/source/BackgroundServiceDelegate.mc @@ -106,12 +106,12 @@ class BackgroundServiceDelegate extends System.ServiceDelegate { var activity = Activity.getProfileInfo().sport; var sub_activity = Activity.getProfileInfo().subSport; data.add({ - "state" => activity ? activity : -1, + "state" => activity != null ? activity : -1, "type" => "sensor", "unique_id" => "activity" }); data.add({ - "state" => sub_activity ? sub_activity : -1, + "state" => sub_activity != null ? sub_activity : -1, "type" => "sensor", "unique_id" => "sub_activity" }); diff --git a/source/WebhookManager.mc b/source/WebhookManager.mc index 162e9c8..80747fe 100644 --- a/source/WebhookManager.mc +++ b/source/WebhookManager.mc @@ -186,7 +186,7 @@ class WebhookManager { var activity = Activity.getProfileInfo().sport; registerWebhookSensor({ "name" => "Activity", - "state" => activity ? activity : -1, + "state" => activity != null ? activity : -1, "type" => "sensor", "unique_id" => "activity", "disabled" => false @@ -199,7 +199,7 @@ class WebhookManager { var sub_activity = Activity.getProfileInfo().subSport; registerWebhookSensor({ "name" => "Sub-activity", - "state" => sub_activity ? sub_activity : -1, + "state" => sub_activity != null ? sub_activity : -1, "type" => "sensor", "unique_id" => "sub_activity", "disabled" => false