diff --git a/accounting/static/accounting/css/report.css b/accounting/static/accounting/css/report.css index 076f0fd..4ad9449 100644 --- a/accounting/static/accounting/css/report.css +++ b/accounting/static/accounting/css/report.css @@ -30,9 +30,6 @@ .date-account-line { font-size: 0.833em; } -.negative { - color: red; -} .journal-credit { padding-left: 1em; } diff --git a/accounting/static/accounting/js/regular-payments.js b/accounting/static/accounting/js/regular-payments.js index 6e2d2c2..b17c6e1 100644 --- a/accounting/static/accounting/js/regular-payments.js +++ b/accounting/static/accounting/js/regular-payments.js @@ -24,7 +24,7 @@ /** * Returns the regular payment data. * - * @returns {{debits: [], credits: []}} + * @returns {{debit: [], credit: []}} */ function getRegularPayments() { const today = new Date($("#txn-date").get(0).value); diff --git a/accounting/static/accounting/js/summary-helper.js b/accounting/static/accounting/js/summary-helper.js index 5b7839c..71e1e3c 100644 --- a/accounting/static/accounting/js/summary-helper.js +++ b/accounting/static/accounting/js/summary-helper.js @@ -142,7 +142,7 @@ function loadSummaryCategoryData() { */ function startSummaryHelper(summary) { // Replaced common substitution character "*" with "×" - summary_content = summary.val(); + let summary_content = summary.val(); summary_content = summary_content.replace(/\*(\d+)$/, "×$1"); const type = summary.data("type"); const no = summary.data("no"); @@ -331,7 +331,7 @@ function switchSummaryTab(tab) { /** * Sets the known general category buttons. * - * @param {string} category the general category + * @param {string|null} category the general category */ function setSummaryGeneralCategoryButtons(category) { $(".btn-summary-general-category").each(function () { @@ -480,7 +480,7 @@ function setSummaryRegularPaymentButtons(category) { * * @param {string} format the category format, either "general", * "travel", or "bus". - * @param {string} category the category + * @param {string|null} category the category */ function setSummaryAccount(format, category) { const recordId = $("#summary-record").get(0).value; diff --git a/accounting/templatetags/accounting.py b/accounting/templatetags/accounting.py index 2a7eddc..18c6a59 100644 --- a/accounting/templatetags/accounting.py +++ b/accounting/templatetags/accounting.py @@ -43,7 +43,7 @@ def accounting_amount(value: Union[str, int]) -> str: break s = m.group(1) + "," + m.group(2) if value < 0: - s = "(%s)" % (s) + s = "(%s)" % s return s diff --git a/mia_core/digest_auth.py b/mia_core/digest_auth.py index dd29c5a..65570ef 100644 --- a/mia_core/digest_auth.py +++ b/mia_core/digest_auth.py @@ -56,10 +56,10 @@ class AccountBackend: """Returns the user by her log in user name. Args: - username (str): The log in user name. + username: The log in user name. Return: - User: The user, or None if the user does not eixst. + The user, or None if the user does not exist. """ return User.objects.filter(login_id=username).first() @@ -133,7 +133,9 @@ def _get_host(ip: str) -> Optional[str]: """ try: return socket.gethostbyaddr(ip)[0] - except Exception: + except socket.herror: + return None + except socket.gaierror: return None diff --git a/mia_core/forms.py b/mia_core/forms.py index 07eef11..83b3041 100644 --- a/mia_core/forms.py +++ b/mia_core/forms.py @@ -146,7 +146,7 @@ class UserForm(forms.Form): raise error def _validate_passwords_equal(self) -> None: - """Validates whether the two passwords are equa. + """Validates whether the two passwords are equal. Raises: forms.ValidationError: When the validation fails. diff --git a/mia_core/period.py b/mia_core/period.py index c080d70..89b5d3c 100644 --- a/mia_core/period.py +++ b/mia_core/period.py @@ -20,8 +20,7 @@ """ import datetime import re -from datetime import date -from typing import Optional, List, Any, Union +from typing import Optional, List from django.core.serializers.json import DjangoJSONEncoder from django.template import defaultfilters @@ -461,7 +460,7 @@ class Period: self.start = datetime.date(year, month, 1) self.end = self._month_last_day(timezone.localdate()) self.description = gettext("Since %s")\ - % self._month_text(year, month) + % self._month_text(year, month) self.prep_desc = self.description return # Until a specific month @@ -474,7 +473,7 @@ class Period: self.start = Period.Parser.VERY_START self.end = self._month_last_day(until_month) self.description = gettext("Until %s")\ - % self._month_text(year, month) + % self._month_text(year, month) self.prep_desc = self.description return # A specific year @@ -495,7 +494,7 @@ class Period: self.end = datetime.date(year, 12, 31) self.start = Period.Parser.VERY_START self.description = gettext("Until %s")\ - % self._year_text(year) + % self._year_text(year) self.prep_desc = self.description return # All time @@ -574,7 +573,7 @@ class Period: int(m.group(3))) self.start = Period.Parser.VERY_START self.description = gettext("Until %s")\ - % self._date_text(self.end) + % self._date_text(self.end) self.prep_desc = self.description return # Wrong period format diff --git a/mia_core/templatetags/mia_core.py b/mia_core/templatetags/mia_core.py index a77f50e..61a27e9 100644 --- a/mia_core/templatetags/mia_core.py +++ b/mia_core/templatetags/mia_core.py @@ -211,4 +211,4 @@ def is_in_section(request: HttpRequest, section_name: str) -> bool: return False view_name = request.resolver_match.view_name return view_name == section_name\ - or view_name.startswith(section_name + ".") + or view_name.startswith(section_name + ".")