Commit graph

119 commits

Author SHA1 Message Date
Tom Hughes
ab4f96261f Drop explicit lengths from bigint columns 2025-02-28 17:22:56 +00:00
Tom Hughes
473aff084d Fix new rubocop warnings 2025-01-14 18:31:52 +00:00
Tom Hughes
d3d0da0328 Fix new rubocop warnings 2024-05-28 17:39:33 +01:00
Tom Hughes
91143a5959 Use imported scope to simplify trace controller methods 2024-03-28 17:26:04 +00:00
Andy Allan
2dfe6f3f2e
Merge pull request #4536 from tomhughes/trace-size-limit
Add a limit on the number of points in a GPS trace
2024-02-25 11:35:20 +01:00
Tom Hughes
741ed58838 Add a limit on the number of points in a GPS trace 2024-02-25 09:50:02 +00:00
Tom Hughes
9444ad494f Reduce priority of multiple simulataneous trace imports 2024-02-24 17:07:38 +00:00
Tom Hughes
33d292e981 Move scheduling of trace import and destruction to the model 2024-02-24 17:07:38 +00:00
Andy Allan
b595b87c48 Use trace instead of gpx_id in queries
This makes the queries easier to read.
2023-08-30 17:08:46 +01:00
Andy Allan
68fa607811 Use hashes to define where..in sql queries
This is preferable to using SQL statements.
2023-08-03 11:04:28 +01:00
Anton Khorev
b54c03389b Strip leading/trailing whitespace from comma-separated trace tags 2022-07-19 13:47:28 +03:00
Tom Hughes
92b122759f Remove support for legacy trace files 2022-03-03 19:47:40 +00:00
Andy Allan
8938ab7997 Remove redundant presence validation on belongs_to
There's no need for us to have it when rails does this for us.
2022-03-01 10:01:16 +00:00
Andy Allan
619ac4c5b2 Enable active_record.belongs_to_required_by_default
This switches the logic so that belongs_to parent objects must exist
by default, and marks the optional ones explicitly. This is reflected
in the null/not_null status on the relevant db columns.
2022-02-23 20:33:28 +00:00
Andy Allan
3cf3b3ce4e Specify inverse_of for trace tags and points
Rails can't automatically detect bi-directional relationships when
`:foreign_key` is present. Adding the `inverse_of` helps when validating
traces and tags that haven't yet been saved.
2022-02-23 15:15:07 +00:00
Tom Hughes
b244905cd2 Add a rake task to migrate trace data to ActiveStorage 2021-12-16 18:45:31 +00:00
Tom Hughes
0410596908 Switch traces to use ActiveStorage 2021-12-16 18:45:31 +00:00
Tom Hughes
22377cbdd4 Fix new rubocop warning 2021-09-29 18:54:56 +01:00
Tom Hughes
582402ba8f Prefer keyword arguments when method has optional boolean arguments 2020-11-13 10:22:55 +00:00
Tom Hughes
0e2a66e8de Fix new rubocop warnings 2020-08-06 18:42:16 +01:00
Tom Hughes
6c159b9673 Fix the Command Injection warnings from Brakeman 2020-07-31 15:54:06 +01:00
Tom Hughes
9f993fe8c8 Fix new rubocop warnings 2020-07-07 10:44:52 +01:00
Tom Hughes
3abeeb7f41 Require open3 before using it 2020-06-26 19:40:37 +01:00
Andy Allan
32e46ad4e3 Remove tempfile patch for trace data
Effectively reverts c0d2ad40c3

This patch is no longer required, since we only use send_data in
combination with Tempfile.read and that all works fine.
2020-04-22 15:16:46 +02:00
Andy Allan
35db86714b Use Open3.capture2 instead of backticks, to avoid command line injection risks
In this situation, trace_name can be trivially checked as legitimate, but this
removes any lingering risks from interpolating into a command line instead of
passing parameters explicitly.

Refs #2229
2020-04-22 13:57:32 +02:00
Andy Allan
a41d500b9f Create an ApplicationRecord for models to inherit from
This is the default for Rails 5+, and also paves the way for
multiple database support.
2019-11-27 11:50:48 +01:00
Tom Hughes
389fee0151 Revert "Always look to the global scope for the GPX module"
This reverts commit fbefe3550c.
2019-08-14 19:06:09 +01:00
Tom Hughes
cbea796ef4 Merge remote-tracking branch 'upstream/pull/2207' 2019-06-26 14:30:30 +01:00
Tom Hughes
ee458b6ee2 Parse each GPX file in an archive separately
Fixes #2253
2019-06-11 12:57:00 +01:00
Tom Hughes
5bb21188e4 Fix rubocop warning 2019-06-05 09:20:00 +01:00
Andy Allan
4377e2bd55 Update annotations to correctly show bigint types 2019-05-29 11:52:20 +02:00
Tom Hughes
9f57f60b87 Fix new rubocop warnings 2019-04-23 09:33:34 +01:00
Frederik Ramm
17e6e69c39 Move generation of gpx_file XML from model to builder 2019-04-14 16:25:14 +01:00
Andy Allan
c1bf73bee4 Use an enumerator for gpx.points, and process the the points in batches 2019-03-20 10:35:40 +01:00
Andy Allan
07fdcf638e Raise exception if there is an error, and import tracepoints in batches 2019-03-20 10:35:40 +01:00
Andy Allan
400db58036 Use activerecord-import for bulk importing tracepoint records
Non-rigourous testing shows a significant speedup, even on ssds.
2019-03-20 10:35:40 +01:00
Andy Allan
d102c9aaf4 Move all settings to settings.yml
We leave the STATUS setting alone, since it's required before rails
boots. The test-specific settings now live in config/settings/test.yml
2019-03-13 18:06:23 +01:00
Tom Hughes
fbefe3550c Always look to the global scope for the GPX module 2019-02-07 18:40:35 +00:00
Tom Hughes
d73a5d4bc0 Merge character validators 2018-11-05 18:54:19 +00:00
Tom Hughes
873ac155ca Improve consistency of text validations 2018-11-05 17:06:48 +00:00
J Guthrie
1e57189366 Added tests for validators 2018-11-05 16:23:30 +00:00
J Guthrie
c2f23fea6a Create invalid_char validators and apply to models 2018-11-05 14:27:03 +00:00
Tom Hughes
de29e9b3f5 Fix Style/NumericPredicate rubocop warnings 2018-09-22 17:34:58 +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
b4be5596f5 Rename xml processing methods with an update_ prefix
They behave differently from the other from_xml methods on other models.
2017-08-30 11:40:54 +01:00
Andy Allan
c647aa3d4d Refactor the from_xml methods to act on existing trace objects.
Setting the new tags with the = operator takes care of removing the
old ones, and is the same approach as taken by the tagstring= method.

Fixes #1600
2017-08-18 10:09:50 +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
Tom Hughes
5b33f3f8e3 Fix rubocop warnings 2017-06-02 00:08:30 +01:00