Coder Social home page Coder Social logo

splittime / opensplittime Goto Github PK

View Code? Open in Web Editor NEW
27.0 27.0 10.0 26.43 MB

Timed endurance event data

Home Page: https://www.opensplittime.org

License: MIT License

Ruby 74.96% JavaScript 2.93% HTML 21.04% SCSS 1.05% Procfile 0.01% CSS 0.01% Shell 0.01%

opensplittime's People

Contributors

billwright avatar cabello avatar cllns avatar danielosborn avatar dependabot[bot] avatar legoabram avatar moveson avatar mrozanski avatar nplasterer avatar snyk-bot avatar winterpk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

opensplittime's Issues

Rake task to delete stale subscriptions

Effort subscriptions are useful only for a limited period of time while the related event is ongoing. For events that have been concluded, effort topics and related subscriptions should be deleted from SNS and from the database.

We should have a rake task that checks each event_group to determine if events have concluded and if efforts have existing topic_arns. If so, the task should:

  1. Delete subscriptions from the database
  2. Delete subscriptions from SNS
  3. Delete topics from SNS

We should then set up a task in Heroku scheduler to run the rake task periodically.

GPX files should be downsized as needed on import

A GPX file attached to a Course is limited in size to 500KB, and in any case, we need to have a limited number of track points (not more than 1000 or so) to make track plotting performant.

Currently, when a GPX file is too large, the user receives an error indicating the file is too large but does not receive any direction about what to do about the problem.

A quick solution would be to point the user to a utility that will reduce resolution of the gpx file in a manner compatible with OST.

A better solution would be to implement resolution adjustment in the background, transparent to the user. This second solution would involve temporary storage of the original file in S3 and then implementation of a service to perform the downsizing. There are some good tools out there (GPSBabel for example) but I don't know of any online service that performs this task.

Mini effort boxes are not displaying

In the Aid Station Summary view and the Effort place view, the blue numbers are clickable but the mini effort list is not appearing. This feature depends on Bootstrap modals and has been inconsistent since the upgrade to Bootstrap 4.

The AJAX request is working properly but the modal content is not being updated.

I'd also like to use Stimulus to trigger the AJAX request and the modal update.

Do not allow duplicate live_times

Live times should be unique across the following fields: Bib number, split_id, bitkey, absolute_time, entered_time, and source. This will avoid duplication that can be caused, for example, when OST Remote is unsuccessful in syncing times (because some live_times are saved and yet OST Remote does not mark them as synced unless the response is successful.

One way to mitigate the issue would be not to create any live_times unless the entire sync batch is successful, but I would prefer to have the incomplete live_time data if there is a problem.

Add "Return" (or "Push Back") buttons to Live Entry screen

In the Live Entry screen, each entry in the Local Data Workspace includes three action buttons: Edit (blue pencil), Delete (red X), and Submit (green checkmark).

Certain entries in the Local Data Workspace (specifically, those that were pulled in for review) will contain persisted Raw Times. These will have the pulled_by and pulled_at attributes set at the time they were pulled for review.

An operator might pull a batch of Raw Times and then decide not to review them right away. In this situation, it would be good to have the ability to remove the times from the Local Data Workspace and mark them as not having been pulled/reviewed.

To accomplish this, we could have a fourth button that would allow the operator to "push" the times back. The icon should be the same as the icon used in the Raw Times/List view to "un-pull" a Raw Time.

When clicked, the button would cause the time entry row to disappear and would send an AJAX request to set pulled_by and pulled_at attributes to nil for the associated Raw Times.

The button should be disabled for time entries that include non-persisted Raw Times.

Event start time appears as UTC in efforts/analyze and efforts/place views

In the heading area of the efforts/analyze and efforts/place views, the event start time appears formatted with UTC instead of the event group home time zone.

In the standard efforts/show and efforts/projections views, no event start time is displayed.

We should make all four views consistent. We could either:

  1. Remove event start time from the headings of the analyze and place views, or
  2. Fix the time zone formatting issue and show the start time in all four views.

Let's use a partial or helper to ensure consistency across the four views.

Duplicate raw_times should be deleted

When importing raw_times, sometimes as a result of an error in client code, identical raw_times may be submitted. Currently this causes an error to be placed on the record because of validations, and this results in 422 being returned because of the presence of the error.

If the "Entered time is an exact duplicate of an existing raw time" error appears, the raw_time should be ignored silently rather than resulting in a 422.

Analyze times are not consistently rounded

On the "Analyze times" tab of an individual's race effort, the "Segment Time/Expected" differences do not match the "Segment Over (Under)". In the screenshot below, in the second row the time/expected shows a different of 5 minutes but the Over(Under) says "(4m)". I think I understand why this happens (rounding of times displayed), but I feel it should be consistent. Or it should display the expected time and over-and-under to the second.

screen shot 2019-02-16 at 4 40 12 pm
.

Best Efforts segment view gives an error if split1 and split2 are the same

From the All Time Best Efforts view for a course, if the operator clicks "Choose a segment" and then chooses the same segment for both the "From" and "To" dropdown menus, the server generates an error.

Expected behavior would be to generate a flash message stating that the user must select two different splits.

Even better would be to rewrite this screen as a JS app and disable the selected "From" split from the "To" menu, and vice versa.

Custom UI for building podium templates

Currently, a race organizer must use an existing podium template or ask a member of the dev team to build a custom template. It would be good to have a tool that allowed users to build their own podium templates.

The tool would need to do basic error checking for gaps in age and gender categories.

Military time bug

An event has a start time on September 23, 2017, at 06:00 Mountain Time (MDT)
An effort has a starting split time of November 4, 2017 at 12:00 Mountain Time (MST)
If a later split time for the effort is set using the military_time attribute, the time is set backwards by one hour.

>> split_time.military_time
#> "17:30:00"
>> split_time.military_time = "17:30:00"
>> split_time.military_time
#> "16:30:00"

The same issue does not happen when setting the time using absolute_time_local:

>> st.absolute_time_local
#> Sun, 04 Nov 2018 17:30:00 MST -07:00
>> st.absolute_time_local = '2018-11-04 17:30:00'
>> st.absolute_time_local
#> Sun, 04 Nov 2018 17:30:00 MST -07:00

The problem is presumably within IntendedTimeCalculator.

Need better handling of visitor clicking on email or sms subscription link

When a visitor clicks on an email or sms subscription link, he or she is redirected to a login screen, but upon logging in, is taken to the home screen. The user should be returned to the screen from which he or she clicked on the subscription link, and the subscription should be created.

Recreate issue:

As a visitor, go to any event or effort view, such as https://www.opensplittime.org/events/hardrock-100-2017. Click any email or sms subscription button under the "Notify Me Live" column.

Upgrade to Rails 6

It's time to get up to date with Rails 6. Before we can get there we need to remove the dependency on ActiveModelSerializers, so this issue depends on #219 which depends on #220.

Send finishing time with text message

Runners will want to know this. Also, if possible, send overall placement in gender. Because of the wave start overall placement is only meaningful if those placements are based on time in the race and not on the time-of-day finishing time.

Docs pages return 500 if parameters provided are invalid

When a user visits documentation pages, there are a few different base URLs, for example /docs/getting_started and /docs/ost_remote. Individual pages are specified using parameters in the URL, such as /docs/ost_remote?page=1&topic=usage.

This works fine so long as the page and topic are valid. But if anything unexpected is provided, for example: /docs/ost_remote?page=10&topic=usage or /docs/ost_remote?page=1&topic=nonexistent, the server returns 500.

We should handle this in such a way that invalid topic or page params do not cause an internal server error but instead result in a 400 response.

Effort import does not show error message

When the server returns 422, the Import Entrants button flashes red, but no error message is shown.

Reproduce by attempting to import any file that does not have a .csv extension.

The error message returned by the server should be displayed in the standard error alert box.

Need RSpec to create a fully stubbed-out event in memory

Several tests rely on dozens of records being written to the database to create an event complete with several efforts, each of which contains several split_times. Examples of this can be found in the spec files for DataStatusService and Segment. These tests take 1-2 seconds each to run, and this takes the majority of the total test time.

In addition, several new tests need to be written that also require an event with several efforts and many split_times. For example, the EffortFinder spec contains a few tests that are described and ready to write, that will need to have an in-memory event+efforts+split_times to run efficiently.

Using either FactoryGirl or a fixture strategy, we need to have the ability to create a stubbed-out event with efforts and split_times in memory.

session[:return_to] redirects not working properly

Certain views may be accessed from different referral sources. For example, split/edit may be accesed from the splits/index view or from the course/show view. For a seamless user experience, the pages should redirect properly to the referring page.

I have attempted to implement a technique that sets session[:return_to] = request.referer in the edit action and then uses session.delete(:return_to) in the update action, as recommended in the first answer in this discussion. But results are inconsistent. See the splits_controller and locations_controller for examples.

I have tried a different technique in the split#destroy action with better luck. But this technique seems more fragile, and I would much prefer a proper solution.

@davetwofeetonthedirt, could you take a look at this issue?

Add donate link to navigation bar

Currently the link to donate to OpenSplitTime is found only in the footer, which is small and not always easy to see. Need to add a 'Donate' link or button to the navigation bar.

Effort#show view needs a "Start effort" button

The Event#stage (admin) view contains a "Start all efforts" button that is visible when the associated event has not yet started (event.started? == false). This is used when efforts have been entered or imported but no times have yet been entered. The events_controller#start_all_efforts action creates a new starting split_time for each effort in the event.

There is currently no way to start an individual effort from the effort view page. That page needs a "Start effort" button that will create a starting split_time for the associated effort.

Access policy should parallel the access policy for starting all efforts, that is to say, the action should be available (and button should be visible) only if the current user is an admin, is the creator of the event, or is a steward of the race.

Organization owner should be able to view generic stats for effort subscriptions

It would be nice to have a page that provides subscription information for a given event group. For example, x subscriptions relating to y efforts (how many by email, how many by text) and z messages sent to date related to the event.

This is probably a new view accessed from the Admin menu.

Owners and Stewards should have access to this information.

Aid Stations are not properly assigned when creating a new event with an existing course

In some cases, not all splits of an existing course are assigned to a new event. Creating a new event on the staging site using the Hardrock Clockwise course, for example, results in splits from Sherman through Finish being assigned, but Start through Burrows are not assigned.

The problem seems to be in event-stage.js, in api.define('events'), in the normalize function, probably lines 342-352.

Caching needs improvement

Currently we are doing caching only on the spread view. The cache is expired every 20 seconds, which is a balance between staleness and performance.

We should be able to improve both using a cache key that incorporates event.updated_at and a cascading touch strategy.

Bib in the Wrong Event Errors

Server does not like it when there are time rows with a bib number and a split that don't belong together.

split_raw_time_rows

ArgumentError at /api/v1/event_groups/92/submit_raw_time_rows

arguments must include split_id

app/services/args_validator.rb, line 69

   64   
   65     def validate_required_params
   66       required.each do |required_arg|
   67         if params[required_arg].nil?
   68           notify_console(args)
>  69           raise ArgumentError, "arguments #{for_klass}must include #{required_arg}"
   70         end
   71       end
   72     end
   73   
   74     def validate_required_alternatives

App backtrace

  • app/services/args_validator.rb:69:in `block in validate_required_params'
  • app/services/args_validator.rb:66:in `each'
  • app/services/args_validator.rb:66:in `validate_required_params'
  • app/services/args_validator.rb:35:in `validate'
  • app/services/args_validator.rb:8:in `validate'
  • app/services/find_expected_lap.rb:9:in `initialize'
  • app/services/find_expected_lap.rb:5:in `new'
  • app/services/find_expected_lap.rb:5:in `perform'
  • app/services/enrich_raw_time_row.rb:53:in `expected_lap'
  • app/services/enrich_raw_time_row.rb:45:in `block in add_lap_to_raw_times'
  • app/services/enrich_raw_time_row.rb:37:in `each'
  • app/services/enrich_raw_time_row.rb:37:in `add_lap_to_raw_times'
  • app/services/enrich_raw_time_row.rb:25:in `perform'
  • app/services/enrich_raw_time_row.rb:10:in `perform'
  • app/services/interactors/submit_raw_time_rows.rb:60:in `enrich_raw_time_row'
  • app/services/interactors/submit_raw_time_rows.rb:31:in `block (2 levels) in perform!'
  • app/services/interactors/submit_raw_time_rows.rb:29:in `block in perform!'
  • app/services/interactors/submit_raw_time_rows.rb:28:in `each'
  • app/services/interactors/submit_raw_time_rows.rb:28:in `perform!'
  • app/services/interactors/submit_raw_time_rows.rb:8:in `perform!'
  • app/controllers/api/v1/event_groups_controller.rb:138:in `submit_raw_time_rows'
  • config/initializers/wrap_parameters.rb:17:in `process_action'

Using the "Pull Times" Button

ArgumentError at /api/v1/event_groups/92/pull_raw_times

time_point is not contained in the provided lap_splits

app/services/split_time_finder.rb, line 72

   67     def scoped_split_times
   68       valid ? split_times.select { |st| st.time_from_start && st.valid_status? } : split_times
   69     end
   70   
   71     def validate_setup
>  72       raise ArgumentError, 'time_point is not contained in the provided lap_splits' unless
   73           ordered_time_points.include?(time_point)
   74       raise ArgumentError, 'split_times do not all belong to the same effort' unless
   75           split_times.map(&:effort_id).uniq.size < 2
   76       raise ArgumentError, 'split_times do not relate to the provided effort' if
   77           effort && split_times.any? { |st| st.effort_id != effort.id }

App backtrace

  • app/services/split_time_finder.rb:72:in `validate_setup'
  • app/services/split_time_finder.rb:28:in `initialize'
  • app/services/split_time_finder.rb:6:in `new'
  • app/services/split_time_finder.rb:6:in `prior'
  • app/services/find_expected_lap.rb:41:in `previous_value'
  • app/services/find_expected_lap.rb:35:in `time_fits_missing'
  • app/services/find_expected_lap.rb:30:in `block in missing_lap'
  • app/services/find_expected_lap.rb:30:in `find'
  • app/services/find_expected_lap.rb:30:in `missing_lap'
  • app/services/find_expected_lap.rb:21:in `perform'
  • app/services/find_expected_lap.rb:5:in `perform'
  • app/services/rowify_raw_times.rb:48:in `expected_lap'
  • app/services/rowify_raw_times.rb:42:in `block in add_lap_to_raw_times'
  • app/services/rowify_raw_times.rb:34:in `each'
  • app/services/rowify_raw_times.rb:34:in `add_lap_to_raw_times'
  • app/services/rowify_raw_times.rb:22:in `build'
  • app/services/rowify_raw_times.rb:8:in `build'
  • app/controllers/api/v1/event_groups_controller.rb:82:in `pull_raw_times'
  • config/initializers/wrap_parameters.rb:17:in `process_action'

Importer tests do not pass

The tests located in spec/models/importer_spec.rb do not pass. The problem seems to be in the creation of @importer, which should be an instance of SplitImporter. One of the parameters for SplitImporter is a file, and I have not been able to get it working. The file is currently located in spec/fixtures/files, which is the correct place based on my research, but it does not work.

If it's possible to use a real file as a parameter in rspec, this should be fixed. If not, then perhaps the code should be changed so we can stub it out instead of importing a real file?

Effort form: Fix state drop-down menu

OpenSplitTime uses the Carmen gem for country and state/subregion identification. The efforts form (views/efforts/_form.html.erb) contains form helpers intended to build country and state menus. The country menu is populated when the form is loaded, and the state menu is populated only if a country has been chosen; if no country is chosen, the state menu indicates 'Choose a country first.' All this is working properly.

When a country is chosen, the state menu should be populated with applicable states/subregions on the fly, but this is not currently working. Instead, when a country is chosen, the state menu remains unchanged, and when the user submits the form, the new effort is assigned to the first state associated with the chosen country (for the United States, it uses Alabama).

This was working properly at one time. It seems likely that the javascript that used to populate the state menu has ceased working or is not getting called.

Note that this same feature exists in the participant form (views/participants/_form.html.erb) and it works properly there.

Time fields in edit_split_times view should be masked

The "Edit times of day" and "Edit elapsed times" views have many time fields, and they should work like the time fields in the live entry view: No need to enter colons, values limited to valid numbers, and so on.

Document OST API with openapi/swagger

We need some reasonable documentation for the API. Swagger/openapi seems like the way to go.

This should be in place before moving away from ActiveModelSerializers (#219) so we can ensure no outward changes to JSON responses.

Plan effort crashes when invalid time is entered

Currently, if a user visits courses/:id/plan_effort and enters certain values in the "Expected time" field, the server returns a 500 error. For example, "18:00:00:00" has this effect.

We need to add an input mask on the front end or check for validity in the controller. An input mask would be by far a better solution from the UI perspective.

Allow deselect from state and country drop-down menus

Effort and participant forms include drop-down menus for selecting the country and state of the participant/effort. Once selected, it should be possible to 'unselect' a state or country, but this is not possible currently.

Deselecting the country should return the state drop-down menu to 'Please select a country first'.

Strong "confirm delete" dialog for deleting events and courses

Deleting an event results in deletion of all efforts and split_times related to that event. Deleting a course results in deletion of all splits related to that course. Either could have significant and non-reversible effects.

The current interface provides a standard "OK/Cancel" confirmation dialog box when a user attempts to delete an event or a course. It would be better if this dialog box contained a more foolproof confirmation; specifically, it should require the user to type the name of the event or course that is to be deleted. The dialog box should work just like the github dialog box for deleting a repo.

Switch from Pusher to ActionCable

For user notifications, Pusher is working, but we've had some trouble with having too many connections open, which could result in moving out of the free tier in the future. It seems like the notifications we are doing could be handled by ActionCable, which would allow us to remove the Pusher dependency.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.