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

PoiCollection in multiple categories - Frontend behaviour #232

Closed
twaurisch opened this issue Oct 4, 2021 · 2 comments
Closed

PoiCollection in multiple categories - Frontend behaviour #232

twaurisch opened this issue Oct 4, 2021 · 2 comments
Assignees
Labels

Comments

@twaurisch
Copy link

If a PoiCollection is assigned to more than one category the frontend behaviour acts not like expected.

Example:
Poi1 is assigned to CatA and CatB, both categories are selected and Poi1 is displayed in the Frontend. If unselecting CatA Poi1 disappears on the map although CatB is still active and Poi1 assigned to it.

Poi1 should only disappear if all assigned categories are not selected.

@twaurisch
Copy link
Author

Example: 3 Pois and 2 Categories

  • Poi1 => [CatA, CatB]
  • Poi2 => [CatA]
  • Poi3 => [CatB]

Result of the database query

in PoiCollectionRepository->addConstraintForCategories(...)

  • Rec1 = Poi1 => [CatA, CatB]
  • Rec2 = Poi1 => [CatA, CatB]
  • Rec3 = Poi2 => [CatA]
  • Rec4 = Poi3 => [CatB]

Categorized marker array

in OpenStreetMaps2.js -> OpenStreetMaps2.prototype.createPointByCollectionType

  • Cat A => [Rec1, Rec2, Rec3]
  • CatB => [Rec1, Rec2, Rec4]

The four records from the database arte the result of a LEFT JOIN in the mentioned method. With this concept each record represents a poi for one category. So each record (_leaflet_id) should be in only one category after 'createPointByCollectionType':

  • Cat A => [Rec1, Rec3]
  • CatB => [Rec2, Rec4]

I created a workaround in the OpenStreetMaps2.js file:

let categorizedLeafletIds = [];
...
if (categorizedLeafletIds.indexOf(marker._leaflet_id) < 0) {
    this.categorizedMarkers[categoryUid].push(marker);
    categorizedLeafletIds.push(marker._leaflet_id);
}

@froemken froemken self-assigned this Mar 3, 2022
@froemken
Copy link
Contributor

froemken commented Mar 7, 2022

Hello @PeaceSfiSh

thank you for your help. I have just uploaded a new version to dev-master solving this issue.

Stefan

@froemken froemken closed this as completed Mar 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants