Commit graph

123 commits

Author SHA1 Message Date
Tom Hughes
9f57f60b87 Fix new rubocop warnings 2019-04-23 09:33:34 +01:00
Tom Hughes
6c2093b29d Fix new rubocop warnings 2018-09-22 17:12:29 +01:00
Andy Allan
b2a8df0bd7 Add annotate gem and associated rake task. Annotate models. 2017-10-22 22:18:26 +01:00
Tom Hughes
8dae890a76 Fix rubocop warnings 2017-10-05 19:18:38 +01:00
Andy Allan
396f2e28dd Rework coordinates to avoid scientific formatting of small numbers. Fixes #1509 2017-06-23 14:03:57 +01:00
Tom Hughes
9b89d4eefe Remove conditions from delete_all
Passing conditions directory to delete_all is deprecated
in rails 5.0 so use a separate where instead.
2017-06-02 16:33:48 +01:00
Andy Allan
4fb775d6d5 Format latitudes and longitudes as %7f in XML output
This matches the double formatting in XML from cgimap. Fixes #341.
2017-03-30 14:30:54 +01:00
Tom Hughes
e5834016fd Clone objects before saving in case of a retry
If a deadlock occurs then the transaction will be retried so we
need to make sure that the object will still be dirty so that it
will be saved again during the retry but that the version won't
be incremented a second time.
2016-11-28 20:31:04 +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
5f4dcd34ff Fix some rubocop warnings 2016-09-15 22:41:07 +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
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
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
e341ef5673 Remove never actually used code from five years ago 2013-10-11 20:03:06 +01:00
Tom Hughes
ca30b879f6 Eliminate deprecated scope and association arguments 2013-09-21 11:35:46 +01:00
Tom Hughes
f03c8637f7 Extract common code for parsing floats 2013-06-24 22:44:17 +01:00
Ian Dees
9d2fed811f Guard against non-numeric lat and lons in nodes and notes 2013-06-24 22:34:09 +01:00
Andy Allan
2c67c079ac Don't show coordinates for deleted nodes 2012-07-11 14:42:01 +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
Peter Gray
95d899786a Refactor bounding box code
Moved duplicated code into the BoundingBox class, and pass around
BoundingBox objects instead of lists of bounds.
2011-11-14 09:42:57 +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
1da4cecaf6 List all objects that are blocking a delete, in a well defined order 2011-11-14 09:42:49 +00:00
Tom Hughes
3d55db46ed Avoid use of deprecated methods on error objects 2011-11-14 09:42:45 +00:00
Tom Hughes
226c41be69 Update ActiveRecord queries to use arel 2011-11-14 09:42:44 +00:00
Tom Hughes
15ab888d0c Make sure asking a node for it's history returns an ordered list 2011-09-14 10:16:44 +01:00
Tom Hughes
a9ff3bfc4b Remove tags from deleted nodes
When ways or relations are deleted we remove their tags and there
is no reason why nodes should be different.
2011-05-05 20:25:58 +01:00
Tom Hughes
f07819d81a Rework application configuration
Use a preinitializer to load the settings from application.yml so
that they are available as early as possible. All settings can also
be overridden using environment variables.

The ad-hoc settins in environment.rb are then moved to this new
system so we have one consistent location for settings.
2010-08-04 22:06:05 +01: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
e4d7b3ee66 Throw errors in the way xml parsing if there is a problem. Bring the way parsing in line with the node parsing. Properly deal with the 0 id case. Some Way.from_xml tests. 2009-06-10 15:42:12 +00:00
Shaun McDonald
e3693d487a More unit tests for the parsing of the Node.from_xml. Some code clean up to ensure that a node that cannot be parsed will always throw an exception, to be handled by the arround handler. 2009-06-08 18:53:19 +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
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
1d48f48827 Fix another mis-referenced error message id! 2009-05-02 18:28:39 +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
Shaun McDonald
33d32bf737 We don't need an extra method for the amf controller for saving nodes, just catch the exception and do nothing with that exception. 2009-04-30 15:16:15 +00:00
Thomas Wood
2861236f60 Fix another error reporting bug similar to previous, again on printing RelationMember.id rather than RelationMember.relation.id 2009-04-30 07:10:57 +00:00