diff --git a/TM1py/Services/ChoreService.py b/TM1py/Services/ChoreService.py index 4d54d954..332ff7a8 100644 --- a/TM1py/Services/ChoreService.py +++ b/TM1py/Services/ChoreService.py @@ -170,6 +170,7 @@ def update(self, chore: Chore, **kwargs): # Update Tasks individually task_old_count = self._get_tasks_count(chore.name) + i = 0 for i, task_new in enumerate(chore.tasks): if i >= task_old_count: self._add_task(chore.name, task_new, **kwargs) diff --git a/Tests/ChoreService_test.py b/Tests/ChoreService_test.py index 3030ca58..c2fe3bf2 100644 --- a/Tests/ChoreService_test.py +++ b/Tests/ChoreService_test.py @@ -308,7 +308,7 @@ def test_update_active_chore(self): def test_update_chore_without_tasks(self): # get chore - c = self.tm1.chores.get(self.chore_name1) + c = self.tm1.chores.get(self.chore_name3) # update all properties # update start time start_time = datetime(2023, 4, 5, 12, 5, 30) @@ -332,9 +332,9 @@ def test_update_chore_without_tasks(self): # update chore in TM1 self.tm1.chores.update(c) # get chore and check all properties - c = self.tm1.chores.get(chore_name=self.chore_name1) + c = self.tm1.chores.get(chore_name=self.chore_name3) self.assertEqual(c._start_time._datetime.replace(microsecond=0), start_time.replace(microsecond=0)) - self.assertEqual(c._name, self.chore_name1) + self.assertEqual(c._name, self.chore_name3) self.assertEqual(c._dst_sensitivity, True) self.assertEqual(c._active, False) self.assertEqual(c._execution_mode, Chore.SINGLE_COMMIT)