From: Christian Heller Date: Fri, 12 Jul 2024 07:32:44 +0000 (+0200) Subject: Minor refactoring. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/add_task?a=commitdiff_plain;h=9063c3110dea47707724aca55f0c906c2b669a4b;p=plomtask Minor refactoring. --- diff --git a/plomtask/http.py b/plomtask/http.py index b7040f7..db54023 100644 --- a/plomtask/http.py +++ b/plomtask/http.py @@ -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} diff --git a/tests/days.py b/tests/days.py index f16c69c..00ba5fd 100644 --- a/tests/days.py +++ b/tests/days.py @@ -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] diff --git a/tests/utils.py b/tests/utils.py index eb874e3..8008033 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -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