[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-bugs] #3708 [TorStatus]: Fix "None" entries in relay list
#3708: Fix "None" entries in relay list
-----------------------+----------------------------------------------------
Reporter: karsten | Owner:
Type: defect | Status: new
Priority: normal | Milestone:
Component: TorStatus | Version:
Keywords: | Parent:
Points: | Actualpoints:
-----------------------+----------------------------------------------------
Comment(by cypherpunks):
Replying to [ticket:3708 karsten]:
> Wendy reports:
> > A minor bug: attempting to sort the list by Bandwidth (desc) shows
"None
> > KB/s" at the top of the list, and "0 KB/s" at the bottom, so I don't
see
> > a way to show the highest bw nodes at the top. Where does "None" come
> > from? Uptime also has both "None d" and "0 d."
>
> I saw this problem, too, but now it's gone. I could imagine it has to
do with the database schema being populated more. Any idea where the
"None" values come from?
That's exactly right. "None" is currently the default value for fields
with null values. In this case, "None" is displayed for fields gathered
from the descriptor table such as bandwidth, uptime, contact, and
published. The confusing part about this is that when "DirPort" is
similarly "None", this means that the relay has opted not to specify a
DirPort. In templates, Django provides a way to specify default values in
the case of null values, which seems like a good solution to this problem.
The sorting problem seems somewhat postgres specific: by default, postgres
displays null values first in descending sorts. In postgres' flavor of
SQL, this can be remedied by appending a 'NULLS LAST' to a query with an
'ORDER BY'. In Django, this could be done with an '.extra' query using the
'COALESCE' function. However, we shouldn't have more than just a few
relays on the index page with null descriptor fields.
--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/3708#comment:1>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online
_______________________________________________
tor-bugs mailing list
tor-bugs@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs