Tom Hughes
282ff4936c
Fix rubocop warnings
2016-10-31 21:24:10 +00:00
Andy Allan
f464e2a6e9
Suppress XML parsing errors.
...
This technique was already used in app/models/changeset.rb
This suppresses the error messages when parsing invalid XML, but
the exceptions are still raised, as tested in test_from_xml_double_lat
in test/models/node_test.rb
2016-10-26 10:35:03 +01:00
Tom Hughes
d82f9d12ce
Fix new rubocop warnings
2016-09-15 19:21:00 +01:00
Tom Hughes
5d3ecffa28
Fix new rubocop warnings
2016-02-05 13:35:26 +00:00
Tom Hughes
8fe1899596
Fix rubocop warnings
2016-01-19 09:51:24 +00:00
Matt Amos
cf6a5c17ee
Fix bug allowing created elements to reference deleted ones
...
The bug allows a newly-created element to refer to a deleted one
if the transactions for both overlap. Precisely, the issue is that
the check that an element exists does not prevent a concurrent
transaction from altering that row.
Because "deleting" an element in the OSM database does not remove
the row, we cannot rely on FK constraints to ensure the correct
behaviour. Instead, this fix relies on manually locking referenced
elements.
Note that this "fix" is suboptimal, as it does not allow any
updates to the referenced elements. Updates which do not delete
the row could safely be done, but will be prevented.
Also, it's not clear what the negative performance impact of this
change will be.
2015-06-13 10:59:57 +01:00
Tom Hughes
2af0840ff3
Fix style issues found by new rubocop version
2015-04-14 09:38:24 +01:00
Tom Hughes
dfc85f089a
Test changeset and note comment notification emails
2015-03-02 00:43:07 +00:00
Tom Hughes
f04211b172
Improve test coverage
2015-02-27 00:40:37 +00:00
Tom Hughes
dbe165bbb3
Fix some rubocop rails style issues
2015-02-26 00:12:54 +00:00
Tom Hughes
a6b84a0294
Fix more rubocop style issues
2015-02-24 23:12:02 +00:00
Tom Hughes
dc2a2c8ebd
Standardise on double quoted strings
2015-02-20 19:47:26 +00:00
Tom Hughes
5cbd4038ed
Fix rubocop style issues
2015-02-20 08:56:16 +00:00
Tom Hughes
baf10cd392
Fix rubocop lint issues
2015-02-20 08:56:16 +00:00
Tom Hughes
ef7f3d800c
Fix most auto-correctable rubocop issues
2015-02-20 08:56:16 +00:00
Tom Hughes
34e3e51456
Cleanup trailing whitespace
2015-02-20 08:56:16 +00:00
Tom Hughes
28b8863627
Remove unused (and non-functioning) code
2014-02-26 18:53:25 +00:00
Tom Hughes
8c029f8d79
Simplify a number of object model methods
2013-12-05 00:50:04 +00:00
Tom Hughes
9544ab12b8
More refactoring of common code in object models
...
Tidy up code and extract generation of tag elements to the
common code in the ObjectMetadata module.
2013-12-04 00:29:48 +00:00
Simon Legner
413baecf6b
Refactor generation of object metadata in API calls
...
Factor out duplicate from the object models into common code.
2013-12-04 00:09:52 +00:00
Tom Hughes
ca30b879f6
Eliminate deprecated scope and association arguments
2013-09-21 11:35:46 +01:00
John Firebaugh
31dae1bac1
Avoid unnecessary array allocations
2012-10-22 08:45:31 +01:00
Matt Amos
8523f53099
Added a test for trac ticket 4471, and fixed the issue.
2012-09-21 09:07:21 +01:00
Matt Amos
67dd9e4c9d
Adding first cut of Redactions support
...
Redactions support hiding historical versions of elements and
collecting meta-data about that action together.
2012-04-05 13:46:36 +01:00
Tom Hughes
92feab9112
Make sure we don't inherit old tags when parsing XML for objects
2012-02-15 17:48:17 +00:00
Tom Hughes
5a8c4faf3e
Replace deprecated methods with modern equivalents
2012-02-15 17:48:17 +00:00
Tom Hughes
fc25c3d412
Rename all ID columns that aren't unique
...
Having a table with a column called ID that is only part of the
primary key really doesn't work as rails likes to treat ID as a
special name so it becomes impossible to assign to it or read it.
2011-11-14 09:42:52 +00:00
Tom Hughes
8ae5d94b2f
Update some more queries to use AREL in place of deprecated methods
2011-11-14 09:42:51 +00:00
Tom Hughes
226c41be69
Update ActiveRecord queries to use arel
2011-11-14 09:42:44 +00:00
Matt Amos
bb84a78a09
Made XML parsing routines raise an exception if the document is valid XML, but not valid as an OSM document. This is now the same behaviour as when the document isn't valid XML.
2009-08-06 17:28:49 +00:00
Shaun McDonald
65eb6af303
Give a nice error message when parsing the nwr tags and they are missing the k and/or v. Also includes tests.
2009-06-11 11:08:37 +00:00
Shaun McDonald
37df03a043
Cleanup the Relation.from_xml to come in line with the Way and Node versions. Includes tests. Bug fix for the previous tests.
2009-06-10 17:17:03 +00:00
Matt Amos
04dbf32b73
Better testing of bbox handling in relations. Maybe fixes #1861 , but wasn't able to reproduce the exact case. Fixed bug handling bboxes where element is repeated in relation.
2009-05-26 15:37:29 +00:00
Matt Amos
4ab495f5db
Added locking around update and delete methods on main API objects. This should remove the 500 errors which come from concurrent overlapping updates. Experimental - might be too slow for production.
2009-05-21 14:57:03 +00:00
Matt Amos
3d0ca940d2
Using an around_handler for catching and rendering errors in most of the API controller methods. This simplifies the code and makes errors and error messages a bit more consistent. Also added a utility method for checking the HTTP method.
2009-05-20 17:39:59 +00:00
Tom Hughes
fa13a11a94
Optimise retrieval of full relations.
2009-05-15 09:10:50 +00:00
Matt Amos
d7badc8402
Fixed precondition failed message which was trying to dereference nil.
2009-05-14 11:19:28 +00:00
Shaun McDonald
7331f82bce
Remove a rescue, which is stopping a more detailed error message being returned to the user.
2009-05-13 23:42:18 +00:00
Matt Amos
b7f306a437
Fixed problem where tag lengths were generating a 422 error with no message. They now generate a 400 error with a meaningful message.
2009-05-10 00:33:55 +00:00
Thomas Wood
c273b4b1fa
Tests for PreconditionFailed error messages.
...
Change to relation.rb to bring element selection in-line with that of way, so to return nil to be caught later, rather than raise an error.
Change to way.rb to clarify which way on diff upload.
2009-05-06 21:08:50 +00:00
Matt Amos
30bbca0f3b
Potential fix for slow relation precondition checking based on Frederik's suggestion on the list to only check new members.
2009-05-06 10:35:39 +00:00
Shaun McDonald
d0e16cdb6c
be a bit more specific when a way is a member of a relation. Actually return an error message when a relation precondition fails. Remove a debug statement.
2009-05-05 17:07:06 +00:00
Tom Hughes
329b6faf91
Use association names with :joins instead of writing the SQL for the
...
join by hand.
2009-04-30 23:45:55 +00:00
Thomas Wood
bb3108cb99
Fix grammar/referred relation id in precondition failed error.
...
From: "Precondition failed: The relation 5 is a used in relation 4,0."
To: "Precondition failed: The relation 5 is used in relation 4."
2009-04-30 06:52:14 +00:00
Matt Amos
3e9b6845d3
Fixed 'raw' raises by converting them to the appropriate OSM::APIError type. Made the error messages for placeholder fixing more informative. Added tests for these.
2009-04-29 10:07:35 +00:00
Tom Hughes
6d1c010213
Use the alias for the conditions as well...
2009-04-28 16:25:37 +00:00
Tom Hughes
074e5b0a11
Use an alias for current_relation_members to avoid clashing with
...
any attempt to eager load it.
2009-04-28 16:15:02 +00:00
Tom Hughes
bf31791f65
Add a changeset cache to stop us looking up the same changeset over
...
and over again when processing a map call.
2009-04-28 13:40:30 +00:00
Tom Hughes
04d0f45845
Remove debugging statement.
2009-04-28 09:00:01 +00:00
Shaun McDonald
0b6d9ce877
Improve the node/way/relation already deleted error message, and get rid bug in way model with missing new in exception
2009-04-27 11:49:56 +00:00