Skip to content

Commit

Permalink
DBC22-1884: added django management command for populating rest stops
Browse files Browse the repository at this point in the history
  • Loading branch information
ray-oxd committed Mar 28, 2024
1 parent 2908047 commit 5b7eef2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from apps.rest.tasks import populate_all_rest_stop_data
from django.core.management.base import BaseCommand


class Command(BaseCommand):
def handle(self, *args, **options):
populate_all_rest_stop_data()
6 changes: 3 additions & 3 deletions src/backend/apps/rest/tasks.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import logging

from apps.feed.client import FeedClient
from apps.shared.enums import CacheKey
from apps.rest.models import RestStop
from apps.shared.enums import CacheKey
from django.core.cache import cache

logger = logging.getLogger(__name__)
Expand All @@ -11,7 +11,7 @@
def populate_rest_stop_from_data(new_rest_stop_data):
rest_stop_id = new_rest_stop_data.get('rest_stop_id')
geometry = new_rest_stop_data.get('geometry')

existing_record = RestStop.objects.filter(rest_stop_id=rest_stop_id).first()
data = {
'rest_stop_id': rest_stop_id,
Expand All @@ -35,4 +35,4 @@ def populate_all_rest_stop_data():
populate_rest_stop_from_data(rest_stop_data)

# Rebuild cache
cache.delete(CacheKey.REGIONAL_WEATHER_LIST)
cache.delete(CacheKey.REGIONAL_WEATHER_LIST)

0 comments on commit 5b7eef2

Please sign in to comment.