From c00b35dc7c25e7ed6a3f4746d9899e1cf9c0e5dd Mon Sep 17 00:00:00 2001 From: Mouse Reeve Date: Mon, 2 Aug 2021 17:55:17 -0700 Subject: [PATCH] Stray file --- bookwyrm/management/commands/ratings_bot.py | 35 --------------------- 1 file changed, 35 deletions(-) delete mode 100644 bookwyrm/management/commands/ratings_bot.py diff --git a/bookwyrm/management/commands/ratings_bot.py b/bookwyrm/management/commands/ratings_bot.py deleted file mode 100644 index 57cd8499..00000000 --- a/bookwyrm/management/commands/ratings_bot.py +++ /dev/null @@ -1,35 +0,0 @@ -""" we have the goodreads ratings......... """ -from datetime import datetime -from django.core.management.base import BaseCommand -from django.utils import timezone -from bookwyrm import models - - -def get_ratings(): - """find and set ratings based on goodreads import lines""" - import_items = models.ImportItem.objects.filter(book__isnull=False).all() - user = models.User.objects.get(localname="goodreads-average-ratings") - for item in import_items: - rating = item.data.get("Average Rating") - if ( - not rating - or models.ReviewRating.objects.filter(user=user, book=item.book).exists() - ): - continue - models.ReviewRating.objects.create( - user=user, - rating=float(rating), - book=item.book.edition, - published_date=timezone.make_aware(datetime(2000, 1, 1)), # long ago - privacy="followers", - ) - - -class Command(BaseCommand): - """dedplucate allllll the book data models""" - - help = "merges duplicate book data" - # pylint: disable=no-self-use,unused-argument - def handle(self, *args, **options): - """run deudplications""" - get_ratings()