From: Christian Heller Date: Wed, 20 Mar 2024 02:52:49 +0000 (+0100) Subject: Remove some redundant code. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/static/do_todos?a=commitdiff_plain;h=5a1e4ec7d9671dd9aa40d05e2af0d7ab25ea8911;p=plomtask Remove some redundant code. --- diff --git a/plomtask/http.py b/plomtask/http.py index 58b575f..e812471 100644 --- a/plomtask/http.py +++ b/plomtask/http.py @@ -72,9 +72,8 @@ class TaskHandler(BaseHTTPRequestHandler): def do_POST_day(self, conn: DatabaseConnection, date: str, postvars: dict): """Update or insert Day of date and fields defined in postvars.""" - comment = postvars['comment'][0] day = Day.by_date(conn, date, create=True) - day.comment = comment + day.comment = postvars['comment'][0] day.save(conn) def _init_handling(self): diff --git a/tests/test_days.py b/tests/test_days.py index ba91c05..f35e6b2 100644 --- a/tests/test_days.py +++ b/tests/test_days.py @@ -93,18 +93,6 @@ class TestsWithDB(TestCase): today.save(self.db_conn) self.assertEqual(Day.all(self.db_conn, ('today', 'today')), [today]) - def test_Day_comment(self): - """Test Day.comment.""" - self.assertEqual(None, Day.by_date(self.db_conn, '2024-01-01')) - d1 = Day('2024-01-01') - d1.save(self.db_conn) - day_retrieved = Day.by_date(self.db_conn, d1.date) - self.assertEqual(day_retrieved.comment, '') - d2 = Day('2024-01-02', 'foo') - d2.save(self.db_conn) - day_retrieved = Day.by_date(self.db_conn, d2.date) - self.assertEqual(day_retrieved.comment, 'foo') - def test_Day_neighbor_dates(self): """Test Day.prev_date and Day.next_date.""" self.assertEqual(Day('2024-01-01').prev_date, '2023-12-31')