Import Limit Bugfix and lint

This commit is contained in:
Giebisch 2023-01-05 23:37:43 +01:00
parent 6d1de44c48
commit 5200ea585a
3 changed files with 5 additions and 2 deletions

View file

@ -34,6 +34,7 @@ class Importer:
"reading": ["currently-reading", "reading", "currently reading"],
}
# pylint: disable=too-many-locals
def create_job(self, user, csv_file, include_reviews, privacy):
"""check over a csv and creates a database entry for the job"""
csv_reader = csv.DictReader(csv_file, delimiter=self.delimiter)
@ -60,6 +61,7 @@ class Importer:
import_jobs = ImportJob.objects.filter(
user=user, created_date__gte=time_range
)
# pylint: disable=consider-using-generator
imported_books = sum([job.successful_item_count for job in import_jobs])
allowed_imports = import_size_limit - imported_books
if allowed_imports <= 0:

View file

@ -76,9 +76,9 @@
</div>
<div class="align.to-t">
<label for="limit">Set import limit to</label>
<input name="limit" class="input is-w-xs is-h-em" type="text" placeholder="0" value={{ import_size_limit }}>
<input name="limit" class="input is-w-xs is-h-em" type="text" placeholder="0" value="{{ import_size_limit }}">
<label for="reset">books every</label>
<input name="reset" class="input is-w-xs is-h-em" type="text" placeholder="0" value={{ import_limit_reset }}>
<input name="reset" class="input is-w-xs is-h-em" type="text" placeholder="0" value="{{ import_limit_reset }}">
<label>days.</label>
{% csrf_token %}
<div class="control">

View file

@ -58,6 +58,7 @@ class Import(View):
import_jobs = models.ImportJob.objects.filter(
user=request.user, created_date__gte=time_range
)
# pylint: disable=consider-using-generator
imported_books = sum([job.successful_item_count for job in import_jobs])
data["import_size_limit"] = site_settings.import_size_limit
data["import_limit_reset"] = site_settings.import_limit_reset