OnlineJudge icon indicating copy to clipboard operation
OnlineJudge copied to clipboard

题目列表display id排序的疑问

Open zqqian opened this issue 7 years ago • 11 comments

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

zqqian avatar Dec 11 '17 13:12 zqqian

看样子目前没有 order by

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

virusdefender avatar Dec 12 '17 09:12 virusdefender

实际上是按照create_time来排序的

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

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

zema1 avatar Dec 12 '17 09:12 zema1

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

zqqian avatar Dec 12 '17 13:12 zqqian

同样有这样的问题

1481767320 avatar Mar 08 '18 13:03 1481767320

默默+1

LucienShui avatar Sep 02 '18 17:09 LucienShui

+1

GNAQ avatar Oct 24 '18 09:10 GNAQ

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

RonTang avatar Dec 01 '18 05:12 RonTang

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

problem Model中Mate ordering设置成-create_time

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

pq-dong avatar Feb 22 '19 02:02 pq-dong

我有興趣修改, 有找到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

dyhe83 avatar Jun 07 '19 15:06 dyhe83

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

Harry-zklcdc avatar Jul 21 '19 14:07 Harry-zklcdc