From b9273e1f5d8eb68387159c8a84bdc535b2b7dfc5 Mon Sep 17 00:00:00 2001 From: baoliang Date: Fri, 12 Mar 2021 16:41:26 +0800 Subject: [PATCH] fix last message bug --- .../views/__pycache__/message.cpython-38.pyc | Bin 3235 -> 3173 bytes polls/views/message.py | 10 ++-------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/polls/views/__pycache__/message.cpython-38.pyc b/polls/views/__pycache__/message.cpython-38.pyc index 7f5877189fefbcb64e1a884f207c0f91993ba0f0..b21ef7c0dbd8f4b531d970a6fa25e60fbe8d3ca0 100644 GIT binary patch delta 764 zcmYL{OHUL*5XYzHJ+rgBurRnUUWz7rz{E#lNPxtka_|w2a4^9jPz~;Ytn@TS%uGli z9#N9Hdf1H~^l0|v(GQ>>VB%2^d<&~PCQj1bzpnqks(WhYW9?71v|KFu8a>mkyU%7y zUrR?&F3{Gbu|Oj}g6z9j&%QzBP&knrd5MnJ33Pq5dw?1`Z}pmX45_iDrDkH>(oW%N zGqptFSWE51ih|Th9CWvJzO(mG6e(gHLt>*ht0fMtzFe_D`e)KgsVmBKij}w+oIvU& zUNk_i;;beP2i5UbRKXHmV5q01e&R>NB$ug(ABBnsh%J>gsAz=rilTEwLyD?I!-{G| zp`tp`h@!?R@To-WHmOb{8tuWZj+DECRV9y+v8HI8jQ9Q-$Nw9#uGER{BsO~TU7NHw zyXOX)C&=|S=B7A!$Q<1s_-O2O%@M{GmHxxLxm z5sc?j$}s?G3?4RC+9U?ufN`d$o<+qY!V(DUf0ivt3->rg9`ynfT{QA>>03SaegC9oVoCdEM;$Swnn#*cWzmHKKtn` z!1aE`^#H=G=~e5}#;+SA?~m*z>Blx{o3@G`3My*xphQJl>7`!$08vV8Gh@xBwRUz26=tbe zJw^(96-f{T@uUI&3GwD>5pN#)SLi#Vf(!G`@15s)pB;98*51~mJ7MT+_|Q-B1HJq) zdJa(;TNBqJuJm*M22SrMPT~rkSUn&bv0v(SEi*Q>%;esImRZ7B(pJxBwy+bQI9)v@ zirlWwR*-_s5e||gtgel_B^;c0cUI)wA*@bkp33osm-tyA0-3@3J1=+%PmBW)`#$lS znh1nXe7O@D{T;<1EAbF7XNeLCdXR-8Od@oZni?;wOM6L$ggxk22U-@1C>cRD!i*>x zRa{2))J#Ru80u9;<47Zl;(f$Xg%e0)ifTyXit2~J?h36xi9z*bY5o__GW)h_yYh9zrrz6ofal(yw=GKneFMfwE4OGq;aNk zMDPzC$zOE@SPH#E3X?y5Lf-?6^F8D1&Eti=Mfsy`!VGCJcT>t(EYVoLe!DO>C}*y0 zo$d96ws~6E4?CNjvce>tHfIw`<7;WRh1o{RS^mN7T`d<5qdU74dl|;6(&lc_G+o=E zsT9-QO`hHh{)Dw;RsmaVLHeMbx2#ul>&TkngAXp0AO;g`q%o`}?mi5ESr@^U7ho6i zE6(NdvvSyOGrETNldqk(STjF#7U9zHo8tk*`46`?DQ)bW^3uId%F}t1HRV~HSG)yS q87_G@K!vdpc^v%nqv4%@0-E_3e;Mu%M}uonJ*9&VrHZPdtiJ*8yUU3H diff --git a/polls/views/message.py b/polls/views/message.py index 0e86951..28dd93d 100644 --- a/polls/views/message.py +++ b/polls/views/message.py @@ -16,15 +16,9 @@ def last_messages(request): return HttpResponse(status=405) id = request.user.id group_id = request.GET.get('group_id') - messages = Message.objects.filter(send_to_id=group_id)[:100] + messages = reversed(Message.objects.filter(send_to_id=group_id).order_by('-added')[:100]) results = [] - filter_dict = dict() - for m in messages: - if m.type == 4 or m.type == 1: - task_id = m.task_id - if task_id: - if task_id in filter_dict: - c = filter_dict[task_id] + for o in messages: result = dict() t = o.type