OnlineJudge
OnlineJudge copied to clipboard
题目列表display id排序的疑问
把一道题目的Display id改到一个比较小的数字, 但是首页中的显示貌似还是按照题目本身的ID排序的。 这道Display id比较小的题目还是在靠后的位置。 请问这个是故意为之还是BUG?
看样子目前没有 order by
https://github.com/QingdaoU/OnlineJudge/blob/master/problem/views/oj.py#L61
实际上是按照create_time来排序的
https://github.com/QingdaoU/OnlineJudge/blob/master/problem/models.py#L76
应该按display_id来的,不过这里有个问题是_id
类型是char的,没法用普通排序来做
那我想把后来创建的题目挪到列表前面去,有什么方法吗?
同样有这样的问题
默默+1
+1
+1,这个功能这么基础,没有的话,题库看起来很乱啊。请帮忙处理一下呀~~~
那我想把后来创建的题目挪到列表前面去,有什么方法吗?
problem Model中Mate ordering设置成-create_time
根据dispaly_id排序可以将取出的queryset集合再排一次序吗?emmm,不知道啊
我有興趣修改, 有找到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
我已经开发好了 见pr:https://github.com/QingdaoU/OnlineJudge/pull/253