Uploaded image for project: 'MusicBrainz Server'
  1. MusicBrainz Server
  2. MBS-3375

Ability to specify sort order for sub-works that are part of an aggregate work.

      We can't set the work parts order in a parent work in the work-work "part of" relationship (related to STYLE-69).
      Example : 組曲「九尾」〜玉藻前〜照魔鏡〜殺生石 (not 殺生石〜照魔鏡〜玉藻前 as it is now reversed, based on title characters)
      From MBS-3062


      I apologize if there's already a ticket for this...

      We need the ability to set the sort order for sub-works.
      For example, is the sub-work, the 1st movement? the 2nd movement? etc...
      This is important because not all sub-works follow the I., II., III., naming convention and there is no way to know what is their original order. (As of now, I'm adding the order in the comments (example: http://musicbrainz.org/work/f86bad98-b743-4597-aeba-8605c7dcb603)

      Perhaps this should be set as an attribute when linking two works.
      Ideally, there should be an AJAX UI where we could drag the new sub-work and drag it into the existing list of parts and place it in the desired position.
      A simpler solution would be to attribute a number to each sub-work (attribute of the work -> part of work relationship) but MB would need to be smart and not allow two sub-works to have the same number (it should automatically move them back if a sub-work is added in the middle.

          [MBS-3375] Ability to specify sort order for sub-works that are part of an aggregate work.

          (This is on the beta server but won't be usable until the link types are actually marked as orderable.)

          Michael Wiencek added a comment - (This is on the beta server but won't be usable until the link types are actually marked as orderable.)

          https://bitbucket.org/metabrainz/musicbrainz-server/pull-request/1429/add-an-admin-interface-for/diff

          This adds the admin interface and makes the arrow buttons move the relationships properly.

          Michael Wiencek added a comment - https://bitbucket.org/metabrainz/musicbrainz-server/pull-request/1429/add-an-admin-interface-for/diff This adds the admin interface and makes the arrow buttons move the relationships properly.

          Yeah, that is possible, though I think the only good way to do that would be to write a postgres extension that can work with ORDER BY to do a natural sort...a while ago I investigated a bunch of PL/SQL and pure-SQL solutions that didn't work out. That might be a good idea. It could be slightly annoying to have to have different sorting code for manual/automatic series, though. Maybe we should get rid of the automatic/manual distinction and just have everything sorted by text attributes. The up/down arrows would have to go in that case.

          Michael Wiencek added a comment - Yeah, that is possible, though I think the only good way to do that would be to write a postgres extension that can work with ORDER BY to do a natural sort...a while ago I investigated a bunch of PL/SQL and pure-SQL solutions that didn't work out. That might be a good idea. It could be slightly annoying to have to have different sorting code for manual/automatic series, though. Maybe we should get rid of the automatic/manual distinction and just have everything sorted by text attributes. The up/down arrows would have to go in that case.

          nikki added a comment -

          Couldn't automatically-ordered series just use the text attributes to determine the order and have all the link orders as 0?

          nikki added a comment - Couldn't automatically-ordered series just use the text attributes to determine the order and have all the link orders as 0?

          Of course for automatically-ordered series, the text attributes are what determine the link orders, so if two items have the same text attribute then the link orders should be either the same, or different but in an undefined order.

          Michael Wiencek added a comment - Of course for automatically-ordered series, the text attributes are what determine the link orders, so if two items have the same text attribute then the link orders should be either the same, or different but in an undefined order.

          I've started fixing the issues nikki mentioned above (already have a working admin interface).

          Regarding the arrow buttons being confusing/unintuitive, I wonder if it'd be a good idea at this point to stop allowing duplicate link orders greater than 0. It's part of the reason the interface is confusing, and I'm not sure of any place that it's used in a valid way right now...where what's "valid" depends on what meaning "link order" should even have outside of the actual code, which is kinda pertinent since it's exposed in the webservice (as "ordering-key"). It certainly seems valid to want to say "these two items in a series have the same position, therefore an undefined sort order relative to each other," but maybe that sort of information is what belongs encoded in the number/text attributes.

          Michael Wiencek added a comment - I've started fixing the issues nikki mentioned above (already have a working admin interface). Regarding the arrow buttons being confusing/unintuitive, I wonder if it'd be a good idea at this point to stop allowing duplicate link orders greater than 0. It's part of the reason the interface is confusing, and I'm not sure of any place that it's used in a valid way right now...where what's "valid" depends on what meaning "link order" should even have outside of the actual code, which is kinda pertinent since it's exposed in the webservice (as "ordering-key"). It certainly seems valid to want to say "these two items in a series have the same position, therefore an undefined sort order relative to each other," but maybe that sort of information is what belongs encoded in the number/text attributes.

          nikki added a comment -

          The orders aren't missing from the edits, the edits themselves are missing. Maybe that's the same thing, but maybe not.

          nikki added a comment - The orders aren't missing from the edits, the edits themselves are missing. Maybe that's the same thing, but maybe not.

          Ulrich Klauer added a comment -

          Yes, it was intended; see this comment on the original pull request.

          I agree the interface isn't very intuitive; I described my experience with it some time ago (with the following comment). I guess the only reason people don't complain about it is that series mostly use automatic ordering.

          Regarding the edits not storing link orders, see this comment and its reply. This also reveals that the "0" display is actually my fault.

          Ulrich Klauer added a comment - Yes, it was intended; see this comment on the original pull request . I agree the interface isn't very intuitive; I described my experience with it some time ago (with the following comment). I guess the only reason people don't complain about it is that series mostly use automatic ordering. Regarding the edits not storing link orders, see this comment and its reply. This also reveals that the "0" display is actually my fault.

          nikki added a comment -

          Testing the code currently on bitmap's sandbox, which I assume works the same as what's currently on the main server:

          This still needs adding to the interface for editing relationship types and should be included on the relationship type documentation pages.

          The orders aren't saved when I submit the edits (which makes testing rather difficult...).

          I find the interface rather confusing and unintuitive to use when trying to edit things where the order hasn't yet been set, because my instinct is to try to move the first relationship to the top of the list, but that's not possible because everything is "0" and therefore already at the "top" of the list, so you have to move everything, including the first thing, down instead.

          Speaking of "0", it also feels rather strange to me to use that in the interface to mean unsorted (behind the scenes sure). It also makes it very time consuming to use - if you have 10 relationships to order, you have to click the down arrows 55 times. If we want to allow both sorted and unsorted, I think we need to reconsider how it should behave.

          It allows the same positions to be appear multiple times. I'm not sure if that was intended.

          nikki added a comment - Testing the code currently on bitmap's sandbox, which I assume works the same as what's currently on the main server: This still needs adding to the interface for editing relationship types and should be included on the relationship type documentation pages. The orders aren't saved when I submit the edits (which makes testing rather difficult...). I find the interface rather confusing and unintuitive to use when trying to edit things where the order hasn't yet been set, because my instinct is to try to move the first relationship to the top of the list, but that's not possible because everything is "0" and therefore already at the "top" of the list, so you have to move everything, including the first thing, down instead. Speaking of "0", it also feels rather strange to me to use that in the interface to mean unsorted (behind the scenes sure). It also makes it very time consuming to use - if you have 10 relationships to order, you have to click the down arrows 55 times. If we want to allow both sorted and unsorted, I think we need to reconsider how it should behave. It allows the same positions to be appear multiple times. I'm not sure if that was intended.

          Ulrich Klauer added a comment -

          The plan is to wait a bit until (most of) the bugs from the schema change release are sorted out.

          Ulrich Klauer added a comment - The plan is to wait a bit until (most of) the bugs from the schema change release are sorted out.

            bitmap Michael Wiencek
            benji99 Benji99
            Votes:
            18 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved:

                Version Package
                2015-04-27