home · contact · privacy
Minor refactoring.
authorChristian Heller <c.heller@plomlompom.de>
Fri, 12 Jul 2024 07:32:44 +0000 (09:32 +0200)
committerChristian Heller <c.heller@plomlompom.de>
Fri, 12 Jul 2024 07:32:44 +0000 (09:32 +0200)
plomtask/http.py
tests/days.py
tests/utils.py

index b7040f76fa9c3c1d58b0ceedc58fabf02752f616..db540230d8e7b7d6d79339c9e72a73ca2cac3939 100644 (file)
@@ -299,12 +299,10 @@ class TaskHandler(BaseHTTPRequestHandler):
         same, the only difference being the HTML template they are rendered to,
         which .do_GET selects from their method name.
         """
-        start = self._params.get_str('start')
-        end = self._params.get_str('end')
-        if not end:
-            end = date_in_n_days(366)
-        ret = Day.by_date_range_with_limits(self.conn, (start, end), 'id')
-        days, start, end = ret
+        start, end = self._params.get_str('start'), self._params.get_str('end')
+        end = end if end else date_in_n_days(366)
+        days, start, end = Day.by_date_range_with_limits(self.conn,
+                                                         (start, end), 'id')
         days = Day.with_filled_gaps(days, start, end)
         today = date_in_n_days(0)
         return {'start': start, 'end': end, 'days': days, 'today': today}
index f16c69ccc5b3beeb2dfc229e51cdc24001432da9..00ba5fd8955517f0005101032b862b7c8cfe619f 100644 (file)
@@ -55,8 +55,8 @@ class TestsWithDB(TestCaseWithDB):
             self.assertEqual(days_result, days_expected)
 
         # for provided Days we use those from days_with_comment, to identify
-        # them against mere filler days by their lack of comment (identity
-        # with Day at the respective position in days_sans_comment)
+        # them against same-dated mere filler Days by their lack of comment
+        # (identity with Day at the respective position in days_sans_comment)
         dates = [f'2024-02-0{n+1}' for n in range(9)]
         days_with_comment = [Day(date, comment=date[-1:]) for date in dates]
         days_sans_comment = [Day(date, comment='') for date in dates]
index eb874e3b4e3e535e1e18ebec170ec4340781df19..8008033955a457c68510d4048e94611f07e3bea0 100644 (file)
@@ -236,7 +236,7 @@ class TestCaseWithDB(TestCaseAugmented):
         tomorrow = datetime.now() + timedelta(days=+1)
         self.assertEqual(start, yesterday.strftime(DATE_FORMAT))
         self.assertEqual(end, tomorrow.strftime(DATE_FORMAT))
-        # make dated items for non-empty results
+        # prepare dated items for non-empty results
         kwargs_with_date = self.default_init_kwargs.copy()
         if set_id_field:
             kwargs_with_date['id_'] = None