Re: Some questions about file handling + some other things
"John P. Rouillard" <[email protected]>
| Newsgroups | gmane.comp.bug-tracking.roundup.user |
|---|---|
| Message-ID | <[email protected]> |
Hi Ralf: In message <[email protected]>, Ralf Schlatterbeck writes: >On Wed, Mar 24, 2021 at 11:05:19AM -0400, John P. Rouillard wrote: >> [it's sorting on the mutltilink property] >> >I would like to deprecate its use. > >Note that you *can* sort by Multilinks, there is currently even a >regression test for this. > >> IIRC there was either a bug report or email thread about sorting by >> multilinks (as opposed to sorting the elements of a multilink). The >> original design doc calls for sorting by len(multilink) IIRC. I don't >> know what sorting by the multilink prop does currently. https://issues.roundup-tracker.org/issue772935 changed sorting from len(multilink) to sort by contents back in 0.6 to fix grouping. Before then multilinks with the same content but only one item didn't sort together breaking grouping. So (stable) Multilink sorting is also required for grouping by multilinks. >OK, currently its implemented as follows: >- Sort each individual multilink property by its order property >- sort the resulting list of lists > >Hardly understandable by humans because if certain lists miss certain >items, the sort order will be completely different. Let me see if I have this. I have three users: id username 4 a_user 5 c_user 6 b_user I have three nosy lists: issue nosy (values from db) 1 4,6 2 5,6 3 4,5,6 After sorting the multilink I get: issue nosy (sorted elements) 1 4,6 2 6,5 3 4,6,5 then I sort the lists getting: issue nosy_list 3 [4,5,6] 1 [4,6] 2 [6,5] Correct? >> I'll have to see if I cand dredge it up. IIRC we came up with a use >> case for this which was saner than the current sorting method. > >that would be fine. Google fu is failing me. >> >I also at one time wanted to implement key properties with multiple >> >values: An application often demands uniqueness over several properties >> >not just one. I discussed this *many* years ago with Richard but he >> >feared at the time that things would be complicated by this. I still >> >think it would be a useful feature. >> >> I would tend to agree it's useful. Maybe a key() function that is >> passed the item? Could be materialized in a _key hidden/reserved >> property name similar to creator/activity.... > >We already have setkey. This could be enhanced to optionally take a >list. Similar for labelprop and orderprop (which default to the key >property if there is one). The *do* have separate set methods where you >can set a labelprop and/or orderprop, these could be enhanced in a >similar fashion. > >Note that once a labelprop can take multiple properties it is unclear >how this should be displayed. I would be ok with: setkey(['name','phone']) then require labelprop be set to a property name setlabelprop("labelname") or a function that gets the values of the properties listed in setkey: setlabelprop(lambda l: l.join("@")) Alternatively: setlabelprop("{name} at {phone}") Since '{' can't be in a property name you can distinguish a format string from a property name. Process it with: "{name}@{phone}".format(**key) with key = { "name": "rouilj", "phone": "0115552134" } to get a label "rouilj@0115552134". If we go the function route, the default function could be: lambda l: l.join(' ') Orderprop as an array would sort by the first value and when the first values compare equal sort by the second value. orderprop(['name', 'phone']) would make sure that: name phone rouilj 0115552134 rouilj 0115553124 rouilj 0115554228 are ordered as above. Maybe we need tuples there to control sort order? orderprop([('+','name'),('-','phone')]) to reverse sort by phone? >Ouch: I didn't think about batches. So far I've used only special pages >without batches. And I don't think you can force a different ordering by >giving IDs or something. So it may well be that this is currently not >possible with batches. Ok. -- -- rouilj John Rouillard =========================================================================== My employers don't acknowledge my existence much less my opinions.