mirror of
https://github.com/task-17-lct/backend.git
synced 2024-11-23 21:13:43 +03:00
resolve confs
This commit is contained in:
parent
b421576cba
commit
f8f0902e97
|
@ -69,8 +69,15 @@ def post(self, request):
|
|||
serializer.is_valid(raise_exception=True)
|
||||
data = serializer.data
|
||||
city_id = data["city"]
|
||||
try:
|
||||
start_date = datetime.strptime(data['date_from'], '%Y-%m-%d')
|
||||
except:
|
||||
start_date = None
|
||||
|
||||
try:
|
||||
end_date = datetime.strptime(data['date_to'], '%Y-%m-%d')
|
||||
except:
|
||||
end_date = None
|
||||
|
||||
try:
|
||||
movement = data['movement']
|
||||
|
@ -109,42 +116,6 @@ def post(self, request):
|
|||
hotel_stars = []
|
||||
|
||||
region = None
|
||||
<<<<<<< HEAD
|
||||
|
||||
if city_id:
|
||||
region = get_object_or_404(City, oid=city_id)
|
||||
else:
|
||||
region = choice(City.objects.annotate(points_count=Count('points')).filter(title__in=city_in_hotels).filter(
|
||||
points_count__gt=400))
|
||||
if not start_date and end_date:
|
||||
tour_length = choice([timedelta(days=i) for i in range(1, 4)])
|
||||
start_date = end_date - tour_length
|
||||
if not end_date and start_date:
|
||||
tour_length = choice([timedelta(days=i) for i in range(1, 4)])
|
||||
end_date = end_date + tour_length
|
||||
if not end_date and not start_date:
|
||||
max_date = datetime.now() + timedelta(days=15)
|
||||
start_date = choice([max_date - timedelta(days=i) for i in range(1, 5)])
|
||||
tour_length = choice([timedelta(days=i) for i in range(1, 4)])
|
||||
end_date = start_date + tour_length
|
||||
|
||||
print(request.user, region, start_date, end_date)
|
||||
|
||||
tour = generate_tour(
|
||||
request.user,
|
||||
region,
|
||||
start_date,
|
||||
end_date,
|
||||
avg_velocity=movement_mapping[movement],
|
||||
stars=hotel_stars,
|
||||
hotel_type=hotel_type,
|
||||
where_eat=where_eat,
|
||||
what_to_see=what_to_see
|
||||
)
|
||||
print(len(tour[1]))
|
||||
|
||||
return Response(data=tour[0])
|
||||
=======
|
||||
|
||||
res = []
|
||||
|
||||
|
@ -187,7 +158,6 @@ def post(self, request):
|
|||
})
|
||||
|
||||
return Response(data=res)
|
||||
>>>>>>> change-out-schema
|
||||
|
||||
|
||||
class ListRegionApiView(ListAPIView):
|
||||
|
|
Loading…
Reference in New Issue
Block a user