Roundup Tracker - Issues


Author rouilj
Recipients ngaba, rouilj, schlatterbeck
Date 2021-03-27.03:59:21
Message-id <>
Details and discussion in thread including:

short form:

sorted method uses:

  value.sort(key=lambda a:a[property], reverse=reverse)

but a[property] is always a string so you get 1, 12, 2, 21, 22 etc.

Need to covert a[property] into it's actual declared type.
Hyperdb has a sort_repr(cls, a[property], property) method
for just this purpose. However there is no method defined for
Integer or Number. Define one for Integer and Number returning
int(val) or float(val) respectively. Also need to handle case
where value (a[property] is None) (see issue2551120) as this
causes a crash.

Extensive discussion on how to handle None state and set it to some
value that will allow the sort to work is inconclusive so far.
I suggest using int(sys.maxint || sys.maxsize) (python2/3)
and float('inf'). This should sort unknown to the end.

Once sort_repr is done for Integer and Float something like:

   cls = self._db.getclass(self._prop.classname)
   sort_repr = # (or maybe cls[property])
   value.sort(key=lambda a:sort_repr(cls, a[property], property),

but I am not sure what self is passed to sort_repr.

Problem found by ngaba.
Date User Action Args
2021-03-27 03:59:23rouiljsetrecipients: + rouilj, schlatterbeck, ngaba
2021-03-27 03:59:23rouiljsetmessageid: <>
2021-03-27 03:59:23rouiljlinkissue2551122 messages
2021-03-27 03:59:21rouiljcreate