Prechádzať zdrojové kódy

change direction of orderBy popular

ilya_shyian 2 rokov pred
rodič
commit
c7a174b795
1 zmenil súbory, kde vykonal 1 pridanie a 1 odobranie
  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]