Modify

Opened 6 years ago

Closed 3 years ago

#17288 closed defect (fixed)

[patch] Notes progress bar shows no progress

Reported by: Klumbumbus Owned by: team
Priority: normal Milestone: 22.05
Component: Core notes Version:
Keywords: template_report Cc: mnalis

Description (last modified by Klumbumbus)

What steps will reproduce the problem?

  1. close some notes or add some comments
  2. upload

What is the expected result?

progress bar displays progress (percent of number of uploaded notes)

What happens instead?

no progress displayed and if console is not open one does not know if josm got stuck or not

additional a text "uploading 4/30" or similar would be nice too.

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

beware! gif is long (more than 3 minutes) (added an other one) and boring ;)

17288.gif


URL:https://josm.openstreetmap.de/svn/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2019-02-02 21:01:18 +0100 (Sat, 02 Feb 2019)
Build-Date:2019-02-04 02:30:51
Revision:14760
Relative:URL: ^/trunk

Identification: JOSM/1.5 (14760 de) Windows 10 64-Bit
OS Build number: Windows 10 Pro 1803 (17134)
Memory Usage: 720 MB / 1820 MB (183 MB allocated, but free)
Java version: 1.8.0_201-b09, Oracle Corporation, Java HotSpot(TM) 64-Bit Server VM
Screen: \Display0 1680x1050
Maximum Screen Size: 1680x1050
VM arguments: [-Djava.security.manager, -Djava.security.policy=file:<java.home>\lib\security\javaws.policy, -DtrustProxy=true, -Djnlpx.home=<java.home>\bin, -Djnlpx.origFilenameArg=C:\Program Files (x86)\josm-latest.jnlp, -Djnlpx.remove=false, -Djava.util.Arrays.useLegacyMergeSort=true, -Djnlpx.heapsize=NULL,2048m, -Djnlpx.splashport=57305, -Djnlpx.jvm=<java.home>\bin\javaw.exe]
Dataset consistency test: No problems found

Plugins:
+ DirectUpload (34867)
+ HouseNumberTaggingTool (34867)
+ OpeningHoursEditor (34867)
+ PicLayer (34867)
+ apache-commons (34506)
+ apache-http (34632)
+ buildings_tools (34867)
+ editgpx (34867)
+ ejml (34389)
+ geojson (116)
+ geotools (34513)
+ imagery-xml-bounds (34803)
+ imagery_offset_db (34867)
+ jna (34867)
+ jogl (1.2.2)
+ jts (34524)
+ log4j (34527)
+ measurement (34867)
+ photo_geotagging (34867)
+ photoadjust (34867)
+ reltoolbox (34867)
+ reverter (34867)
+ rex (49)
+ tag2link (34867)
+ tageditor (34867)
+ tagging-preset-tester (34678)
+ terracer (34867)
+ turnlanes-tagging (280)
+ turnrestrictions (34867)
+ undelete (34877)
+ utilsplugin2 (34867)
+ wikipedia (v1.1.1)

Tagging presets:
+ https://josm.openstreetmap.de/josmfile?page=Presets/OneClick&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Presets/StolpersteineLight&zip=1
+ %UserProfile%\Documents\OSM\josm\data\defaultpresets.xml
+ %UserProfile%\Documents\OSM\TestNew\newpresets.xml
+ https://josm.openstreetmap.de/josmfile?page=Presets/PhilippinesAddresses&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Presets/NewTags&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Presets/Heritage&zip=1

Map paint styles:
+ %UserProfile%\Documents\OSM\josm\styles\standard\elemstyles.mapcss
- https://josm.openstreetmap.de/josmfile?page=Styles/HiDPISupport&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/NewHighwayColors&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Styles/Coloured_Streets&zip=1
- %UserProfile%\Documents\OSM\TestNew\newicons.mapcss
- https://josm.openstreetmap.de/josmfile?page=Styles/Modified&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Maxspeed&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Lane_and_Road_Attributes&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/sac_scale&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/ShowID&zip=1
- %UserProfile%\Documents\OSM\eigene styles\PriorityRoad\PriorityRoad_1.0.mapcss
- https://josm.openstreetmap.de/josmfile?page=Styles/LayerChecker&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Surface&style&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/ParkingLanes&style&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Sidewalks&style&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Cycleways&style&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Osmc&style&zip=1
- https://raw.githubusercontent.com/species/josm-preset-wheelchair/master/sidewalks_kerbs.mapcss
- https://josm.openstreetmap.de/josmfile?page=Styles/LitObjects&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Lit&style&zip=1
- %UserProfile%\Documents\OSM\eigene styles\Tourenplanung.mapcss
- %UserProfile%\Documents\OSM\eigene styles\SpecificBuildingValues\SpecificBuildingValues.mapcss
- https://josm.openstreetmap.de/josmfile?page=Styles/Coloured_buildings&zip=1
- https://github.com/bastik/mapcss-tools/raw/osm/mapnik2mapcss/osm-results/mapnik.zip
- %UserProfile%\Documents\OSM\eigene styles\area-symbol.zip
- http://www.freietonne.de/ft_icons/josm/FreieTonne_rules_presets_zip.php
- http://www.openrailwaymap.org/styles/standard.zip
- https://josm.openstreetmap.de/josmfile?page=Styles/MaxspeedIcons&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/DestinationSignRelation&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/ParkingLanes&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Incline&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/PTStops&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/AdvertisingStyle&zip=1
- https://www.dropbox.com/s/qo3ai47fpv241jf/Styles_Fixme_and_Notes.zip?raw=1
- https://github.com/gmgeo/osmic-josm-style/archive/master.zip
- https://josm.openstreetmap.de/josmfile?page=Styles/hazmat&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Coloured_Suburb&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/Coloured_Postcode&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/RecyclingMaterials&zip=1
- %UserProfile%\Documents\OSM\eigene styles\maxspeed\maxspeed_2.9_01 basierend auf 2.7_02 Zahlen.mapcss
- https://josm.openstreetmap.de/josmfile?page=Styles/Bench&zip=1
- https://josm.openstreetmap.de/josmfile?page=Styles/PublicTransportV2&zip=1
- %UserProfile%\Documents\OSM\eigene styles\colourtag\colourtag_1.0.mapcss
- https://josm.openstreetmap.de/josmfile?page=Styles/ColourTag&zip=1
- %UserProfile%\Downloads\coloured_kerbs_style.zip
- https://josm.openstreetmap.de/josmfile?page=Styles/Admin_Boundaries&zip=1
- https://raw.githubusercontent.com/species/josm-preset-traffic_sign_direction/master/direction.mapcss

Validator rules:
+ https://raw.githubusercontent.com/<user.name>n-a-bauer/josm-validators/master/mtb.validator.mapcss
- %UserProfile%\Documents\OSM\TestNew\germ.validator.mapcss
- https://josm.openstreetmap.de/josmfile?page=Rules/CzechRepublicAddressSystem&zip=1
+ %UserProfile%\Documents\OSM\TestNew\new.validator.mapcss
+ https://josm.openstreetmap.de/josmfile?page=Rules/GermanySpecific&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Rules/OsmoseValidations&zip=1

Last errors/warnings:
- W: No configuration settings found.  Using hardcoded default values for all pools.

Attachments (3)

17288.gif (3.6 MB ) - added by Klumbumbus 6 years ago.
17288.png (191.1 KB ) - added by Klumbumbus 6 years ago.
17288.patch (12.2 KB ) - added by taylor.smock 3 years ago.
Improve UI feedback for uploading notes, add basic test to ensure that notes are uploaded when expected. Original patch by gaben, modified. Tests by taylor.smock.

Change History (18)

by Klumbumbus, 6 years ago

Attachment: 17288.gif added

comment:1 by Klumbumbus, 6 years ago

Description: modified (diff)

comment:2 by Klumbumbus, 6 years ago

Description: modified (diff)

by Klumbumbus, 6 years ago

Attachment: 17288.png added

comment:3 by Klumbumbus, 6 years ago

Description: modified (diff)

comment:4 by mnalis, 5 years ago

Cc: mnalis added

comment:5 by mnalis, 5 years ago

can confirm this is still present in current testing (15492)

comment:6 by gaben, 4 years ago

I'm not sure, but maybe it just this much:

  • src/org/openstreetmap/josm/actions/upload/UploadNotesTask.java

    a b  
    6565        protected void realRun() throws SAXException, IOException, OsmTransferException {
    6666            ProgressMonitor monitor = progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false);
    6767            OsmApi api = OsmApi.getOsmApi();
     68            monitor.setTicksCount(noteData.getNotes().size());
    6869            for (Note note : noteData.getNotes()) {
     70                monitor.setCustomText(tr("Uploaded notes {0}/{1}", monitor.getTicks(), monitor.getTicksCount()));
    6971                if (isCanceled) {
    7072                    Logging.info("Note upload interrupted by user");
    7173                    break;
     
    7678                        processNoteComment(monitor, api, note, comment);
    7779                    }
    7880                }
     81                monitor.worked(1);
    7982            }
    8083        }

comment:7 by gaben, 3 years ago

Summary: Notes progress bar shows no progress[patch] Notes progress bar shows no progress

This seems to work, please test before commit :)

  • src/org/openstreetmap/josm/actions/upload/UploadNotesTask.java

     
    6363
    6464        @Override
    6565        protected void realRun() throws SAXException, IOException, OsmTransferException {
    66             ProgressMonitor monitor = progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false);
    6766            OsmApi api = OsmApi.getOsmApi();
     67            getProgressMonitor().setTicksCount(noteData.getNotes().size());
    6868            for (Note note : noteData.getNotes()) {
     69                getProgressMonitor().setCustomText(tr("Uploading notes {0}/{1}", getProgressMonitor().getTicks(), getProgressMonitor().getTicksCount()));
    6970                if (isCanceled) {
    7071                    Logging.info("Note upload interrupted by user");
    7172                    break;
     
    7374                for (NoteComment comment : note.getComments()) {
    7475                    if (comment.isNew()) {
    7576                        Logging.debug("found note change to upload");
    76                         processNoteComment(monitor, api, note, comment);
     77                        processNoteComment(getProgressMonitor(), api, note, comment);
    7778                    }
    7879                }
     80                getProgressMonitor().worked(1);
    7981            }
    8082        }

comment:8 by gaben, 3 years ago

Any comment/suggestion on the provided patch?

comment:9 by taylor.smock, 3 years ago

This is probably better than the current implementation (little UI feedback).

Comments:

  • L69 is longer than 145 characters (ant pmd checkstyle)
  • Non-modified notes are counted (noteData.getNodes.size()). This can probably be worked around by getting the modified notes first (e.g., noteData.getNotes().stream().filter(note -> note.getLastComment().isNew()).collect(Collectors.toList())), and using that as the collection.

Modified patch from comment:7 (I am going to need to test what happens with a new comment sometime), and I think that someone should write some tests for it (either gaben or myself, probably).

  • src/org/openstreetmap/josm/actions/upload/UploadNotesTask.java

    diff --git a/src/org/openstreetmap/josm/actions/upload/UploadNotesTask.java b/src/org/openstreetmap/josm/actions/upload/UploadNotesTask.java
    index 60fb2c91e8..3a704a07bd 100644
    a b package org.openstreetmap.josm.actions.upload;  
    44import static org.openstreetmap.josm.tools.I18n.tr;
    55
    66import java.io.IOException;
     7import java.util.Collection;
    78import java.util.HashMap;
    89import java.util.Map;
     10import java.util.Optional;
    911import java.util.stream.Collectors;
    1012
    1113import javax.swing.JOptionPane;
    public class UploadNotesTask {  
    6365
    6466        @Override
    6567        protected void realRun() throws SAXException, IOException, OsmTransferException {
    66             ProgressMonitor monitor = progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, false);
    6768            OsmApi api = OsmApi.getOsmApi();
    68             for (Note note : noteData.getNotes()) {
     69            final Collection<Note> modifiedNotes = noteData.getNotes().stream()
     70                    .filter(note -> Optional.ofNullable(note.getLastComment()).map(NoteComment::isNew).orElse(false))
     71                    .collect(Collectors.toList());
     72            getProgressMonitor().setTicksCount(modifiedNotes.size());
     73            for (Note note : modifiedNotes) {
     74                getProgressMonitor().setCustomText(tr("Uploading notes {0}/{1}", getProgressMonitor().getTicks(),
     75                        getProgressMonitor().getTicksCount()));
    6976                if (isCanceled) {
    7077                    Logging.info("Note upload interrupted by user");
    7178                    break;
    public class UploadNotesTask {  
    7380                for (NoteComment comment : note.getComments()) {
    7481                    if (comment.isNew()) {
    7582                        Logging.debug("found note change to upload");
    76                         processNoteComment(monitor, api, note, comment);
     83                        processNoteComment(getProgressMonitor(), api, note, comment);
    7784                    }
    7885                }
     86                getProgressMonitor().worked(1);
    7987            }
    8088        }
    8189

by taylor.smock, 3 years ago

Attachment: 17288.patch added

Improve UI feedback for uploading notes, add basic test to ensure that notes are uploaded when expected. Original patch by gaben, modified. Tests by taylor.smock.

comment:10 by taylor.smock, 3 years ago

Milestone: 22.05

comment:11 by gaben, 3 years ago

Thank you!

comment:12 by taylor.smock, 3 years ago

No problem. I'd merge it right now, but I'm still uncertain as to whether or not we are going to do a 22.04 release. Going by wiki:DevelopersGuide/Schedule, it should have been last weekend (last weekend of April), but recent practice has been first weekend of the month (in this case, also last weekend, but we've also been a week or so late, see r18002 (2021-07-11)).

If I haven't merged it in two weeks, I probably forgot about this. Feel free to ping this ticket at that point.

comment:13 by stoecker, 3 years ago

Milestone: 22.0522.07

Milestone renamed

comment:14 by stoecker, 3 years ago

Milestone: 22.0722.05

comment:15 by taylor.smock, 3 years ago

Resolution: fixed
Status: newclosed

In 18443/josm:

Fix #17288: Notes progress bar shows no progress (patch by gaben, modified)

The patch provided by gaben was modified to only count modified notes for
the progress bar and count. Technically speaking, this is a little less
efficient, as the modified notes will have to iterate through comments
twice instead of once. This should not be noticeable to end users, as
they should not (generally speaking) be closing enough notes for this
to be an issue.

UploadNotesTask now has a test (not by gaben) to check for correctness.

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.