Browse Source

change direction of orderBy popular

ilya_shyian 2 years ago
parent
commit
c7a174b795
1 changed files with 1 additions and 1 deletions
  1. 1 1
      store_back/apps/goods/schema.py

+ 1 - 1
store_back/apps/goods/schema.py

@@ -104,7 +104,7 @@ class Query(graphene.ObjectType):
             query_set = query_set.filter(reduce(operator.or_,(Q(**d) for d in [dict([i]) for i in filter_params.items()])))
 
         if order_by == 'popular':
-            query_set = query_set.annotate(order_count=Count('orderGoods')).order_by("order_count")[skip:skip+limit]
+            query_set = query_set.annotate(order_count=Count('orderGoods')).order_by("-order_count")[skip:skip+limit]
         else:
             query_set = query_set.order_by(order_by)[skip:skip+limit]