Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SourceView: go to measure… function returns wrong measure #432

Open
bwbohl opened this issue Sep 18, 2024 · 4 comments
Open

SourceView: go to measure… function returns wrong measure #432

bwbohl opened this issue Sep 18, 2024 · 4 comments
Labels
Type: bug report Type: good first issue A small fix that could be tackled by newcomers ;-)
Milestone

Comments

@bwbohl
Copy link
Member

bwbohl commented Sep 18, 2024

If the edition uses @n for a technical enumeration of mei:measure and @label for a semantical naming of the measures, which is, e.g., needed if a measure breaks across systems, using the "go to measure…" function in sourceView returns the wrong measure, because the function for finding the correct measure-ID relies on @n.

(($mei/id($movementId)//mei:measure[@n eq $measureIdName])[1])

@bwbohl bwbohl added this to the 1.0.0 milestone Sep 18, 2024
@peterstadler
Copy link
Member

Is there any idea on how to fix this?

@bwbohl
Copy link
Member Author

bwbohl commented Oct 10, 2024

Is there any idea on how to fix this?

Maybe something like?

 (($mei/id($movementId)//mei:measure[@label eq $measureIdName], $mei/id($movementId)//mei:measure[@n eq $measureIdName])[1]) 

@bwbohl
Copy link
Member Author

bwbohl commented Oct 11, 2024

The above could provide a quick fix, but…

On a second thought, maybe thiw would not be ideal in cases of measures breaking across systems (and maybe even pages) because then it would only return the first part of the measure (the first measure with a matching @label).

This needs a more detailed look and a proper refactoring would be the ideal, i.e.:

  1. This query is called from 3 places

    and was adjusted each time a new functionality was added to Edirom Online.
    I think this is in the order of implementation history:

    1. app/controller/window/source/SourceView.js from the function onGotoMeasureByName (which this issue originally was about)

      parameters:

      • id: view.uri, --> xmldb:uri pointing to the MEI to query
      • measure: measure, --> user input from GotoMsg form field (type: string)
      • movementId: movementId
    2. app/controller/window/source/MeasureBasedView.js
      from the function onShowMeasure: function(view, uri, measureId, count)

      parameters:

      • id: uri, --> xmldb:uri pointing to the MEI to query
      • measure: measureId, --> the xml:id of the first measure to show
      • measureCount: count --> the number of measures to show starting from measureId
    3. app/controller/window/source/VerovioView.js from the function onGotoMeasureByName

      parameters:

      • id: view.uri, --> xmldb:uri pointing to the MEI to query
      • measure: measure,
      • movementId: movementId

    While the id parameter is always some xmldb:uri pointing to the MEI file, measure can be either a completely uncontrolled string OR an xml:id, movementId is used in (1.) context to provide a context for retrieving the measure by 'name' and measureCount is used in (2.) to accomodate the option of MeasureBasedView to show multiple measures starting from the selected one. (I skipped checking the details for (3.) for now)

All in all I think a bigger refactoring would be good in this context but for now a small fix should be tested.

@bwbohl bwbohl added the Type: good first issue A small fix that could be tackled by newcomers ;-) label Oct 11, 2024
@bwbohl
Copy link
Member Author

bwbohl commented Oct 11, 2024

This also touches the context of #102

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: bug report Type: good first issue A small fix that could be tackled by newcomers ;-)
Projects
Status: Backlog
Development

No branches or pull requests

2 participants