Skip to content

Restore per-sub-query map markers (#98) - #99

Merged
JeroenDeDauw merged 1 commit into
masterfrom
restore-subquery-map-markers
Jun 25, 2026
Merged

JeroenDeDauw merged 1 commit into
masterfrom
restore-subquery-map-markers

Conversation

@alistair3149

@alistair3149 alistair3149 commented Jun 25, 2026 •

Copy link
Copy Markdown
Member

Problem

#compound_query lets each sub-query carry its own display parameters, including a per-sub-query map marker:

{{#compound_query:
  [[Har sidtyp::socken]] [[Har status::aktiv]] ;?Har koordinat ;icon=Marker_Chartreuse.svg
 |[[Har sidtyp::socken]] [[Har status::startgrop]] ;?Har koordinat ;icon=Marker_LightGrey.svg
 |format=leaflet
 ...
}}

After upgrading to SCQ 4.0 these custom markers stopped rendering — every result fell back to the default icon (#98).

Cause

SCQ attaches each sub-query's processed parameters to its result data items as a display_options field. Maps reads that field in QueryHandler::getLocationIcon() to pick the icon (and legend label) for each marker:

$display_location = $row[0]->getResultSubject();
if ( property_exists( $display_location, 'display_options' ) && is_array( $display_location->display_options ) ) {
    $icon = $display_location->display_options['icon'];
}

4.0.0 removed the only producer of that field (commit 33cc6fb, #87) on the premise that nothing read it. Maps does, so the markers disappeared.

Fix

Restore the assignment, extracted into an attachDisplayOptions() helper so it can be unit tested. Each result data item again receives the sub-query's processed parameters as display_options, and Maps picks up the per-sub-query icon.

The PHP 8.2 dynamic-property deprecation that #87 set out to fix no longer applies: SCQ 4.x requires SMW >= 7.0, whose DataItem base class is marked #[AllowDynamicProperties], so writing display_options to a result data item is deprecation-free under every supported configuration.

CompoundQueryResult::addResult() — the orphaned reader removed alongside the producer — stays removed; it has no callers.

Testing

  • New unit test testAttachDisplayOptionsAddsOptionsToEveryResult asserts every result data item receives the sub-query parameters as display_options.
  • composer analyze (lint + PHPCS + minus-x) and composer phpunit (unit + integration, 63 tests) pass on MW 1.43 / SMW 7.x / PHP 8.1.

🤖 Generated with Claude Code

@codecov

codecov Bot commented Jun 25, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 32.52%. Comparing base (3050a6b) to head (5fc33da).

Files with missing lines Patch % Lines
src/CompoundQueryProcessor.php 66.66% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master      #99      +/-   ##
============================================
+ Coverage     29.56%   32.52%   +2.95%     
- Complexity       41       44       +3     
============================================
  Files             4        4              
  Lines           115      123       +8     
============================================
+ Hits             34       40       +6     
- Misses           81       83       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread RELEASE-NOTES.md Outdated
SCQ attaches each sub-query's processed parameters to its result data
items as a `display_options` field. Maps reads that field in
QueryHandler::getLocationIcon() to render the custom marker (`icon`) and
`legend label` configured for an individual #compound_query sub-query.

4.0.0 removed the producer (33cc6fb, #87) on the premise that nothing
read `display_options`. Maps does, so custom markers stopped showing once
a wiki upgraded to SCQ 4.0.

Restore the assignment, extracted into attachDisplayOptions() so it can
be unit tested. The PHP 8.2 dynamic-property deprecation that #87 fixed no
longer applies: SCQ 4.x requires SMW >= 7.0, whose DataItem base class is
marked `#[AllowDynamicProperties]`, so writing `display_options` to a
result data item is deprecation-free.
@alistair3149
alistair3149 force-pushed the restore-subquery-map-markers branch from 54bbafb to 5fc33da Compare June 25, 2026 21:20
@alistair3149
alistair3149 marked this pull request as ready for review June 25, 2026 21:29
@JeroenDeDauw

Copy link
Copy Markdown
Member

Did you verify this somehow?

@alistair3149

Copy link
Copy Markdown
Member Author

Did you verify this somehow?

Yes by trying to reproduce the original bug:

Before:
scq98-before-broken

After:
scq98-fixed-map

@JeroenDeDauw
JeroenDeDauw merged commit c4ba361 into master Jun 25, 2026
6 checks passed
@JeroenDeDauw
JeroenDeDauw deleted the restore-subquery-map-markers branch June 25, 2026 22:09
@malberts

Copy link
Copy Markdown
Contributor

Verified, before and after:
00-buggy-map-closeup
03-fixed-map-closeup

Can we get this released already?

@malberts malberts mentioned this pull request Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants