瀏覽代碼

change direction of orderBy popular

ilya_shyian 2 年之前
父節點
當前提交
c7a174b795
共有 1 個文件被更改,包括 1 次插入1 次删除
  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]