thermostat

Just a TDD exercise
git clone https://git.tronto.net/thermostat
Download | Log | Files | Refs | README

commit bfcd604688bab3fc11d1a2c8b95789bae4f62507
parent ac6e625811682b96f4b1a73ab53a163dab806e6c
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date:   Sun, 28 May 2023 22:25:26 +0200

[REFACTOR] Removed unnecessary conditional

Diffstat:
Mthermostat.py | 11+++++------
1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/thermostat.py b/thermostat.py @@ -12,12 +12,11 @@ class Thermostat: def GetCurrentRequiredTemperature(self): time = self.GetCurrentTime() lastTemp = 10 - if len(self.setPoints) > 0: - for sp in self.setPoints: - if sp[0] <= time: - lastTemp = sp[1] - else: - return lastTemp + for sp in self.setPoints: + if sp[0] <= time: + lastTemp = sp[1] + else: + return lastTemp return lastTemp def AddSetPoint(self, hour, temperature):