-
Notifications
You must be signed in to change notification settings - Fork 6
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
Added opening hours validator. #5
Added opening hours validator. #5
Conversation
Additionally, the package pyopening_hours should probably be bundled with qat_script to ensure that it is present. |
Hi!
Just start JOSM from the terminal.
The following things should be fixed in your code. https://github.com/ypid/qat_script/blob/added-opening_hours_validator/tools/data/OpeningHoursValidator/OpeningHoursValidator.py#L19 https://github.com/ypid/qat_script/blob/added-opening_hours_validator/tools/data/OpeningHoursValidator/OpeningHoursValidator.py#L78
I have seen Anyhow, if you want to integrate the error detection by pyopening_hours into qat_script you should copy the part from line 54 of Hint: uncomment these lines while testing, so that you don't have to restart JOSM every time you modify |
Thanks for your answer.
What do you mean by PR?
I tried this already, but it seems that not every stack trace makes it to the console. Thats why I asked. It worked most of the times … |
* Copied icons from https://github.com/ypid/opening_hours_map/tree/master/img * Wrote gen_translations to convert translations from https://github.com/ypid/opening_hours.js/blob/master/js/i18n-resources.js * Generated translations. Open problems: * pyopening_hours can not be imported? * self.isTranslated = True causes crash without error message in the console.
Sorry, pull request.
I noticed the same problem some time ago while executing a part of the code in another thread, maybe while downloading (DownloadTask) or parsing errors (ParseTask); but in this case, the error message shows up on my console:
You should add the translation of the view (the category collecting all your tool's checks) to the ResourceBoundle. For example: Another fix. On a different note, it seems that the data is correclty downloaded from overpass and parsed, since logging says:
Could you please add the modules to the pull request so I can test it? |
…the console. Thanks to simone-f#5 (comment)
Run `make` to move it to the correct location. File "$HOME/Projekte/src/osm/qat_script/pyopening_hours/OpeningHours.py", line 16, in <module> from com.xhaus.jyson import JysonCodec as json ImportError: No module named xhaus
socket.error: (104, 'Software caused connection abort')
Since it is such a pain to get this all working in jython I guess it would be much better to do all the evaluation stuff server side in nodejs. Any thoughts? Would you like to test it? Doing this on a server would also have the advantage of not adding the dependencies nodejs and pyopening_hours to qat_script … |
Yes, it would be better.
I don't know nodejs but I would willingly test your server. |
It works great so far. Thanks very much for this plugin. Are line breaks not supported in the "user_message"? Could you please test it. I am not sure how to implement support for the other opening_hours related tags in an elegant way. And how can I show different markers for error and warnings. I would appropriate it (if you have the time) to look over the current pull request and maybe rewrite it a bit if necessary. You know the code base much better than I do. The other tags which can be covered easily are listed here. The first item in the array is the oh_mode that needs to be fed into |
I have to say. Fixing (opening_hours) problems with qat_script is a bliss 👍 The only thing to remember is to check the value if you do not know exactly how it is interpreted because you do not see this in the tool. I usually copy complicated values over to the evaluation tool or use the link generated in the help for the problem 😄 and fix them there because it is easier to see the difference. Also, the evaluation tool will always prettify the value. JOSM does this only if there is a warning for the value (You can force JOSM to generate a warning if you want the prettified value by adding a small mistake like using a dot as hour minute separator in a time like this "12.00-14:00"). The evaluation tool makes it also easier to remove redundant parts of the value. |
I'm happy it works :-) Actualy, there is a problem if you try to download and parse errorOnly or warningOnly, but you can fix it with the following changes (here):
You can use
Do you mean in the first check with both errors and warnings? Unfortunately a check can have only one icon.
Sure. I will refine it and see how to add support for the other tags like "lit" (the next weeks). Before I merge the pull request I suggest you to:
|
* Added tool icon. See ypid/opening_hours.js@64dd4fe * Applied patch from @simone-f. * Using HTML tags for newline in user message. * Resized and redesigned markers. Other improvements. * Removed proof_of_concept.
Done ;) I am looking forward to your cleanup and the integration of the missing tags so that people can actually use it. |
Thanks for the changes and for the fixes in the first commits of your pull request. |
Added opening hours validator.
simone-f/qat_script#5 should work now properly also with other tags.
Thanks for merging and for adopting it. |
Hi
Nice validation plugin. I tried to add support for opening_hours but I have no idea how to debug it in JOSM. I did not find a error console or something like this. Next thing is that I do not run any logic or scripts on server side to evaluate opening_hours errors. So my approach for this plugin is simply to download all opening_hours in one area and check them with pyopening_hours for problems on the client.
I wrote a proof of concept. If you like it could you please adopt the API of qat_script for this and get it to work in JOSM to get me started?