Commit graph

134 commits

Author SHA1 Message Date
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
Matt Amos
6c66507427 Patching better 412 error messages from mis-commit on old api06 branch. 2009-04-24 10:08:15 +00:00
Matt Amos
9ff7ea8d71 Added better error messages on 412 precondition failed. 2009-04-23 18:39:36 +00:00
Matt Amos
1654b3d407 Quick and dirty fix for relation tags issue. 2009-04-21 23:40:27 +00:00
Shaun McDonald
08bd1688ee Railsify the relation member model, type attribute, by putting it into class case, rather than lower case. Requires reload of postgres databases or manual change to the enum. Fixes the databrowser on postgres, however affects the rest of the codebase. 2009-04-15 14:49:21 +00:00
Matt Amos
afcb345014 Moved a bunch of time functions into UTC. Fixes bugs which we only see for 4 hours a year. 2009-03-29 01:31:04 +00:00
Matt Amos
be75a1504f Fixed a couple of bugs with changeset bounding box calculation when modifying or deleting. 2009-03-27 12:22:23 +00:00
Thomas Wood
6167bb6502 Shut up libxml's "Must specify a string with one or more characters" error on relation and way models. 2009-03-23 21:52:32 +00:00
Tom Hughes
c8ee135104 Merge 12304:14009 from trunk. 2009-03-08 13:02:37 +00:00
Tom Hughes
07c1cd6b98 Update to use libxml 1.0.0 gem. 2009-03-08 11:34:46 +00:00
Shaun McDonald
b7335940e2 Some improvements for the XML parsing, as there are somethings that we don't need, like timestamp and visibility, thus hopefully bringing a speedup in the xml parsing. Some more AMF controller fixes, plenty more to go though. 2008-12-09 18:44:11 +00:00
Shaun McDonald
e9527b363d Refactoring the amf controller, and all models so that save_with_history! is now private. Everyone should use create_with_history, delete_with_history, and update_from instead. Also gets the amf controller to do version checks in the node/way/relation models. Needs checked. This breaks Potlatch until #1376 is fixed. 2008-12-04 17:30:17 +00:00
Shaun McDonald
6e98e324e5 better handling of duplicate tags. Extra validation in the tests. 2008-11-28 17:38:23 +00:00
Matt Amos
299b671522 Moved transaction boundary to cover used-by tests on deletion so that the database can help prevent race conditions. 2008-11-26 14:49:56 +00:00
Shaun McDonald
8348493ccb Some improvements to the error messages that are returned by the api. 2008-11-25 18:59:35 +00:00
Shaun McDonald
1375095343 More model validations. Fixing one test. 2008-11-25 17:23:47 +00:00
Shaun McDonald
0ff1214f86 Make the role in relations optional, with a test to make sure it is. Also start moving the errors reading the xml to exceptions, thus making it possible to give meaningful error messages, when bad xml is sent (More work is required on this including doing the same for nodes and ways). With the latest gems update it seems that the lib xml handling was broken, using the newer method. Adding the content type for the exceptions. 2008-11-24 18:55:24 +00:00
Matt Amos
a90be5e69a Migration to add close-time to changesets. This replaces the boolean 'open' attribute. Added checks to ensure that the maximum lifetime and number of changes in a changeset are enforced. Added some tests. 2008-11-17 19:00:01 +00:00
Matt Amos
e79fd07638 Made relations ordered. Added some tests for this. Otherwise interface is unchanged. 2008-11-10 15:41:05 +00:00
Dave Stubbs
322d293007 update nodes/ways/relation XML to include user id as well as display name 2008-11-09 16:43:09 +00:00
Andy Allan
7058d836f7 use boolean flags when using boolean columns 2008-11-07 13:24:18 +00:00
Matt Amos
d43a327a95 Implemented changeset bounding box handling for relations, based on the conversation on the mailing list. Its a bit complex... 2008-11-06 17:56:24 +00:00