chore(core): remove obsolete price fixing command and update .gitignore
Removed the unused `fix_prices` management command to clean up legacy code. Updated `.gitignore` to include vendor documentation files, ensuring the directory is consistent in version control.
This commit is contained in:
parent
8245fe4d36
commit
3c652febe3
3 changed files with 1 additions and 28 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -188,6 +188,7 @@ test.ipynb
|
||||||
.scrapy
|
.scrapy
|
||||||
.cover
|
.cover
|
||||||
.pybuilder/
|
.pybuilder/
|
||||||
|
engine/core/vendors/docs/*
|
||||||
|
|
||||||
# Production
|
# Production
|
||||||
.initialized
|
.initialized
|
||||||
|
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
import logging
|
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
from django.core.management.base import BaseCommand
|
|
||||||
|
|
||||||
from engine.core.models import Product
|
|
||||||
from engine.core.vendors import AbstractVendor
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
|
||||||
def handle(self, *args: list[Any], **options: dict[Any, Any]) -> None:
|
|
||||||
self.stdout.write(self.style.SUCCESS("Starting fixing stocks' prices..."))
|
|
||||||
|
|
||||||
for product in Product.objects.filter(stocks__isnull=False):
|
|
||||||
for stock in product.stocks.all():
|
|
||||||
try:
|
|
||||||
stock.price = AbstractVendor.round_price_marketologically(
|
|
||||||
stock.price
|
|
||||||
)
|
|
||||||
stock.save()
|
|
||||||
except Exception as e:
|
|
||||||
self.stdout.write(
|
|
||||||
self.style.WARNING(f"Couldn't fix price on {stock.uuid}")
|
|
||||||
)
|
|
||||||
self.stdout.write(self.style.WARNING(f"Error: {e}"))
|
|
||||||
self.stdout.write(self.style.SUCCESS("Successfully fixed stocks' prices!"))
|
|
||||||
0
engine/core/vendors/docs/.gitkeep
vendored
Normal file
0
engine/core/vendors/docs/.gitkeep
vendored
Normal file
Loading…
Reference in a new issue