Modify

Opened 4 years ago

Closed 3 years ago

#20851 closed defect (fixed)

Tagging preset: value_template does not update value, right away, with conditions

Reported by: skyper Owned by: team
Priority: normal Milestone: 21.07
Component: Core Version: latest
Keywords: template_report tagging preset value_template condition update Cc: simon04

Description (last modified by skyper)

Sorry, simon04. I really love this feature but it still is not working properly. Thanks for your work.

What steps will reproduce the problem?

  1. Have a condition in the expression for value_template="" like the one in #20842.
  2. Have a relation selected matching the preset with some of the tags already tagged
  3. Open the preset, change a tag which is used in the expression with a condition, like route=*.
    <group name="Public Transport" icon="presets/transport/bus.svg">
        <item name="Public Transport Route (Rail)" icon="presets/misc/route.svg" type="relation" preset_name_label="true">
            <link wiki="Public_transport#Service_routes" />
            <space />
            <key key="type" value="route" />
            <combo key="route" text="Route type" values="train,subway,monorail,tram,light_rail" values_searchable="true" match="keyvalue!" />
            <key key="public_transport:version" value="2" /> <!-- only validate marked relations in order to avoid false positives -->
            <text key="name" text="Name" value_template="?{route=train 'Train'|route=subway 'Subway'|route=monorail 'Monorail'|route=tram 'Tram'|route=light_rail 'Light_rail'|''} {ref}?{': {from} - {via} - {to}'|': {from} - {to}'|''}" />
            <text key="ref" text="Reference" />
            <text key="from" text="from" />
            <text key="to" text="to" />
            <text key="via" text="Via" />
        </item> <!-- Public Transport Route (Rail) -->

What is the expected result?

The value is adjusted right away, after changing any tag which is used in the expression.

What happens instead?

The value might be adjusted when closing the dialog with "ok" but not always

Please provide any additional information below. Attach a screenshot if possible.

It work with tags not part of a condition, like ref=*.
Opening the preset after closing changes the value again to the correct content.
The expression, especially conditions, are not always evaluated after changing an involved tag.

One more question: Is it wise to change an existing value, automatically, without user's interaction??
Think we need at least a preference option to enable/disable this feature of overwriting values.

Relative:URL: ^/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2021-05-04 21:01:14 +0200 (Tue, 04 May 2021)
Revision:17860
Build-Date:2021-05-05 01:30:58
URL:https://josm.openstreetmap.de/svn/trunk

Plugins:
+ tagging-preset-tester (35640)

Tagging presets:
+ ${HOME}/JOSM/new/resources/data/defaultpresets_17833_route_17661_18662.xml

Attachments (3)

josm_20851_open_preset.png (16.3 KB ) - added by skyper 4 years ago.
open preset with values
josm_20851_remove_from.png (16.3 KB ) - added by skyper 4 years ago.
remove from value in preset
josm_20851_reopen_preset.png (16.4 KB ) - added by skyper 4 years ago.
reopen preset after close with incorrect value

Download all attachments as: .zip

Change History (20)

comment:1 by skyper, 4 years ago

Description: modified (diff)

comment:2 by skyper, 4 years ago

Cc: simon04 added
Description: modified (diff)

comment:3 by skyper, 4 years ago

Description: modified (diff)

comment:4 by simon04, 4 years ago

Milestone: 21.05
Owner: changed from team to simon04
Status: newassigned

comment:5 by simon04, 4 years ago

In 17875/josm:

see #20851, see #20842 - Revert "Fix UOE in TaggingPresetItemGuiSupport.evaluateCondition"

This reverts commit r17859.

comment:6 by simon04, 4 years ago

Resolution: fixed
Status: assignedclosed

In 17876/josm:

fix #20851, see #20842 - Tagging presets: value_template="..." for conditional template

comment:7 by simon04, 4 years ago

In 17877/josm:

see #20851 - Tagging presets: value_template="..." for <combo>

in reply to:  description comment:8 by skyper, 4 years ago

Replying to skyper:

One more question: Is it wise to change an existing value, automatically, without user's interaction??
Think we need at least a preference option to enable/disable this feature of overwriting values.

See #20861.

comment:9 by skyper, 4 years ago

Description: modified (diff)

comment:10 by skyper, 4 years ago

Thanks, it does nicely update now.

Is it possible to use java functions (e.g. mapcss java functions) in the expressions to solve my problem with multiple values which I want to split?
May you, please, take another look at the documentation at the bottom of the attributes' section. Try & Error is not the best method to document a new function.

Last edited 4 years ago by skyper (previous) (diff)

comment:11 by skyper, 4 years ago

Resolution: fixed
Status: closedreopened

Sorry, but there is still a minor glitch using above preset.

  1. Have a relation matching the preset with from=*, to=* and via
  2. Open preset and remove the values for all three tags.
    • I still find two - in name=* which are never deleted no whether I delete the the whole value of name=* nor changing any other tag's value.
  3. Close preset
    • wrong name value
  4. Open preset again
    • Finally the correct value is used.

comment:12 by simon04, 4 years ago

Can you share a screenshot, please?

by skyper, 4 years ago

Attachment: josm_20851_open_preset.png added

open preset with values

by skyper, 4 years ago

Attachment: josm_20851_remove_from.png added

remove from value in preset

by skyper, 4 years ago

reopen preset after close with incorrect value

comment:13 by skyper, 4 years ago

Well, I changed the expression a little bit but the problem still exists:

<text key="name" text="Name" value_template="?{route=train 'Train'|route=subway 'Subway'|route=monorail 'Monorail'|route=tram 'Tram'|route=light_rail 'Light_rail'|''}?{' {ref}'|''}?{': {from} - {via} - {to}'|': {from} - {to}'|''}" />

Open preset with some tags already added to the relation:

open preset with values

Remove from=*, which should remove everything behind "Train".

remove from value in preset

Closing the presets leads to the incorrect value Train: - B - C.
Reopening the preset finally leads to the correct value.

reopen preset after close with incorrect value

comment:14 by simon04, 4 years ago

In 17919/josm:

fix #20952, see #20851 - Revert "Tagging presets: value_template="..." for <combo>"

This reverts commit r17877

comment:15 by simon04, 4 years ago

Milestone: 21.05
Owner: changed from simon04 to team
Status: reopenednew

comment:16 by Don-vip, 3 years ago

Milestone: 21.07

comment:17 by Don-vip, 3 years ago

Resolution: fixed
Status: newclosed

In 18080/josm:

fix #21156 - fix #20851 - see #20861 - disable value_template for multiple selection (patch by marcello)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.