Skip to content
Permalink
Browse files

Add marking of review requests and bot users

  • Loading branch information...
MichaelVL committed May 28, 2018
1 parent 8e50c35 commit 68e4c03d1e385e57da5d210db16f0781d7af189d
@@ -11,7 +11,7 @@ ADD docker/regions.txt .
RUN wget --no-verbose -i regions.txt

RUN mkdir -p /html-init/dynamic
COPY html/addresses.html html/cset_notes.html html/diffmap.html html/styles.css html/att.png html/att_l.png html/csetopen.png html/csetopen_l.png html/dev_work.png html/err.png html/err_l.png html/favicon.png html/gear.png html/gear_l.png html/icon_bw.png html/josm-icon.png html/layers.png html/node.png html/note.png html/note_l.png html/osm-icon.png html/relation.png html/user.png html/user_l.png html/way.png html/leaflet-button.js html/timestamp.js /html-init/
COPY html/addresses.html html/cset_notes.html html/diffmap.html html/styles.css html/att.png html/att_l.png html/csetopen.png html/csetopen_l.png html/dev_work.png html/err.png html/err_l.png html/favicon.png html/gear.png html/gear_l.png html/icon_bw.png html/josm-icon.png html/layers.png html/node.png html/note.png html/note_l.png html/osm-icon.png html/relation.png html/user.png html/user_l.png html/bot_l.png html/way.png html/leaflet-button.js html/timestamp.js /html-init/

RUN mkdir /html-init/jquery-2.1.3
ADD https://code.jquery.com/jquery-2.1.3.min.js /html-init/jquery-2.1.3/jquery.min.js
BIN +14 Bytes (100%) html/bot_l.png
Binary file not shown.
@@ -9,6 +9,7 @@
"min_lat": 5, "max_lat": 10,
"min_lon": 7, "max_lon": 14,
"tag": {"comment": "Adjustments of foo bar #mapping-event",
"created_by": "JOSM"
"created_by": "JOSM",
"bot": "no"
}
}
@@ -0,0 +1,68 @@
[{"action": "create",
"data": {"changeset": 10,
"id": 10000,
"lat": 54.0,
"lon": 10.0,
"tag": {},
"timestamp": "2016-05-01T16:19:37Z",
"uid": 1000,
"user": "Karl Koder",
"version": 1,
"visible": true},
"type": "node"},
{"action": "create",
"data": {"changeset": 10,
"id": 10001,
"lat": 54.1,
"lon": 10.1,
"tag": {},
"timestamp": "2016-05-01T16:19:37Z",
"uid": 1000,
"user": "Karl Koder",
"version": 1,
"visible": true},
"type": "node"},
{"action": "modify",
"data": {"changeset": 10,
"id": 200001,
"lat": 54.1,
"lon": 10.1,
"tag": {"osak:identifier": "123456789"},
"timestamp": "2016-05-01T16:19:37Z",
"uid": 2345678,
"user": "Ronny the Rover",
"version": 2,
"visible": true},
"type": "node"},
{"action": "create",
"data": {"changeset": 10,
"id": 200000,
"nd": [10000, 10001],
"tag": {"highway": "track"},
"timestamp": "2016-05-01T16:19:37Z",
"uid": 2345678,
"user": "Ronny the Rover",
"version": 1,
"visible": true},
"type": "way"},
{"action": "modify",
"data": {"changeset": 10,
"id": 200001,
"nd": [10100, 10101],
"tag": {"highway": "track"},
"timestamp": "2016-05-01T16:19:37Z",
"uid": 2345678,
"user": "Ronny the Rover",
"version": 2,
"visible": true},
"type": "way"},
{"action": "delete",
"data": {"changeset": 10,
"id": 200002,
"timestamp": "2016-05-01T16:19:37Z",
"uid": 2345678,
"user": "Ronny the Rover",
"version": 2,
"visible": false},
"type": "way"}
]
@@ -0,0 +1,17 @@
{"uid": 1000,
"id": 10,
"user": "testuser",
"open": false,
"comments_count": 0,
"discussion": [],
"created_at": "2015-05-01T16:09:37Z",
"closed_at": "2015-05-01T16:09:47Z",
"min_lat": 5, "max_lat": 10,
"min_lon": 7, "max_lon": 14,
"tag": {"comment": "Adjustments of foo bar #mapping-event",
"created_by": "JOSM",
"bot": "yes",
"review_requested": "yes",
"source": "Day dreaming"
}
}
@@ -11,7 +11,11 @@
<!-- cset_head_basic -->
<li>
<div class="legend" style="background-color: #{{info.misc.user_colour}}">&#8203;</div>
{% if 'bot' in meta.tag and meta.tag.bot == 'yes' %}
<div class="user"><div class="icon"><img src="/bot_l.png"></div><a href="http://www.openstreetmap.org/user/{{meta.user}}">{{meta.user|e}}</a> (bot)</div>
{% else %}
<div class="user"><div class="icon"><img src="/user_l.png"></div><a href="http://www.openstreetmap.org/user/{{meta.user}}">{{meta.user|e}}</a></div>
{% endif %}
{% if 'comment' in meta.tag and meta.tag.comment|trim|length != 0 %}
<div class="changeset"><a href="http://www.openstreetmap.org/changeset/{{meta.id}}">{{meta.tag.comment|e}}</a></div>
{% else %}
@@ -60,7 +64,10 @@
{% endif%}
{% if 'address-node-change' in c.labels %}
<li><div class="warning"><div class="icon"><img src="/att_l.png"></div>Modifies address node(s)</div></li>
{%- endif %}
{% endif %}
{% if 'review_requested' in meta.tag and meta.tag.review_requested == 'yes' %}
<li><div class="warning"><div class="icon"><img src="/att_l.png"></div>Review requested</div></li>
{% endif %}
{% if meta.comments_count>0 %}
<li><img src="/note.png">
{% if meta.comments_count==1 %}
@@ -38,7 +38,7 @@ class TestCsetFilter(BaseTest):
@patch('tempfilewriter.TempFileWriter')
@patch('osm.poly.Poly')
@patch('osm.changeset.OsmApi')
def test_cset_filter1_and_backend(self, OsmApi, Poly, FileWriter, IsFile, Listdir, Remove, MsgBus):
def test_cset_filter1_and_backend_cset10(self, OsmApi, Poly, FileWriter, IsFile, Listdir, Remove, MsgBus):
IsFile.return_value = True
Listdir.return_value = self.listdir
OsmApi.return_value = self.osmapi
@@ -67,8 +67,11 @@ def test_cset_filter1_and_backend(self, OsmApi, Poly, FileWriter, IsFile, Listdi
self.assertTrue('html/dynamic/notes.html' in self.files)

self.assertTrue('setView(new L.LatLng(56.0, 11.4),6)' in self.files['html/index.html'])

self.assertTrue('No changesets' not in self.files['html/dynamic/today.html'])
self.assertTrue('-- Changeset 10 source' in self.files['html/dynamic/today.html'])
self.assertTrue('No source attribute' in self.files['html/dynamic/today.html'])

self.assertTrue('Total navigable: 12,888 meters (6,444m/hour)' in self.files['html/dynamic/today-summ.html'])
self.assertTrue('1 changesets by 1 user' in self.files['html/dynamic/today-summ.html'])

@@ -89,6 +92,44 @@ def test_cset_filter1_and_backend(self, OsmApi, Poly, FileWriter, IsFile, Listdi
#self.print_file('html/dynamic/cset-10.bounds')
self.assertTrue('5,7,10,14' in self.files['html/dynamic/cset-10.bounds'])

@patch('osmtracker.messagebus.Amqp')
@patch('osmtracker.BackendGeoJson.remove')
@patch('osmtracker.BackendGeoJson.listdir')
@patch('osmtracker.BackendGeoJson.isfile')
@patch('tempfilewriter.TempFileWriter')
@patch('osm.poly.Poly')
@patch('osm.changeset.OsmApi')
def test_cset_filter1_and_backend_cset11(self, OsmApi, Poly, FileWriter, IsFile, Listdir, Remove, MsgBus):
IsFile.return_value = True
Listdir.return_value = self.listdir
OsmApi.return_value = self.osmapi
Poly.return_value.contains_chgset.return_value = True
FileWriter.side_effect = self.fstart
new_cset = {'cid': 11, 'source': {'type': 'minute', 'sequenceno': 20000, 'observed': '2018-01-07T19:37:00'}}
osmtracker.cset_filter(self.cfg, self.db, new_cset)
self.assertEqual(self.db.csets[0]['state'], self.db.STATE_BOUNDS_CHECKED)
osmtracker.csets_analyse_initial(self.cfg, self.db, new_cset)

#print 'DB:{}'.format(pprint.pformat(self.db.csets))

self.cfg.cfg['backends'][0]['labels'] = ['adjustments']
osmtracker.run_backends(self.args, self.cfg, self.db, 'new_generation.osmtracker')
#print 'files:', self.files.keys()
#print 'xx', FileWriter.mock_calls
self.print_file('html/dynamic/today.html')
#self.print_file('html/dynamic/dk_addresses.html')
#self.print_file('html/dynamic/today-summ.html')
#print 'filemocks', self.filemocks[0].mock_calls
self.assertTrue('html/index.html' in self.files)
self.assertTrue('html/dynamic/dk_addresses.html' in self.files)
self.assertTrue('html/dynamic/today-summ.html' in self.files)
self.assertTrue('html/dynamic/today.html' in self.files)
self.assertTrue('html/dynamic/today.json' in self.files)
self.assertTrue('html/dynamic/notes.html' in self.files)

self.assertTrue('-- Changeset 11 source' in self.files['html/dynamic/today.html'])
self.assertFalse('No source attribute' in self.files['html/dynamic/today.html'])

@patch('osmtracker.messagebus.Amqp')
@patch('osmtracker.BackendGeoJson.remove')
@patch('osmtracker.BackendGeoJson.listdir')

0 comments on commit 68e4c03

Please sign in to comment.
You can’t perform that action at this time.