QingdaoU / OnlineJudge

Open source online judge based on Vue, Django and Docker. | 青岛大学开源 Online Judge | QQ群 496710125 | admin@qduoj.com
http://opensource.qduoj.com/
MIT License
6.05k stars 1.47k forks source link

题目列表display id排序的疑问 #106

Open zqqian opened 6 years ago

zqqian commented 6 years ago

把一道题目的Display id改到一个比较小的数字, 但是首页中的显示貌似还是按照题目本身的ID排序的。 这道Display id比较小的题目还是在靠后的位置。 请问这个是故意为之还是BUG?

virusdefender commented 6 years ago

看样子目前没有 order by

https://github.com/QingdaoU/OnlineJudge/blob/master/problem/views/oj.py#L61

zema1 commented 6 years ago

实际上是按照create_time来排序的

https://github.com/QingdaoU/OnlineJudge/blob/master/problem/models.py#L76

应该按display_id来的,不过这里有个问题是_id类型是char的,没法用普通排序来做

zqqian commented 6 years ago

那我想把后来创建的题目挪到列表前面去,有什么方法吗?

1481767320 commented 6 years ago

同样有这样的问题

LucienShui commented 6 years ago

默默+1

GNAQ commented 5 years ago

+1

RonTang commented 5 years ago

+1,这个功能这么基础,没有的话,题库看起来很乱啊。请帮忙处理一下呀~~~

pq-dong commented 5 years ago

那我想把后来创建的题目挪到列表前面去,有什么方法吗?

problem Model中Mate ordering设置成-create_time

根据dispaly_id排序可以将取出的queryset集合再排一次序吗?emmm,不知道啊

dyhe83 commented 5 years ago

我有興趣修改, 有找到string的排序法。

但是對django, postgres不熟,請問該怎麼替換這的sort方法?? https://github.com/QingdaoU/OnlineJudge/blob/e8ae0d4aac8ac80bf0b5f01f7d755b08c7866ff6/problem/models.py#L88


Alphanum algorithm 字串排序的範例

https://github.com/dyhe83/Python-String-Alphanum-Sort

test_strings = ['1', '2', '3', '10', '1a1', '1a2', '1b', '1a', '1 a 2', '1 a 1', '1 b', '1 a']

# after sort
1
1 a
1 a 1
1 a 2
1 b
1a
1a1
1a2
1b
2
3
10
Harry-zklcdc commented 5 years ago

我已经开发好了 见pr:https://github.com/QingdaoU/OnlineJudge/pull/253

sawyerYoung commented 4 months ago

我已经开发好了 见pr:#253

为什么我下过来的还是没按display_id排序的