blonsky95 / AthleticsPointsCalculatoriOS

0 stars 0 forks source link

Points formulae #2

Open blonsky95 opened 3 years ago

blonsky95 commented 3 years ago

Captura de pantalla 2021-03-14 a las 19 31 08

So next, there will be a class (PointsScorerHelper.swift) which has a static method to getPoints given an event and a score (distance, height or time whatever).

This class needs to be initialised at the start to build an array of closures that return the points depending on if its a throw, jump or run as well as which event. The equation is different for each throw, jump or run, and the coefficients a,b and c (see above image) vary per event.

So first I will have a JSON file containing the a, b, c coefficients, and I will build a function that decodes this into a dictionary of <String (event name), Closure(you give score, it returns points)>

blonsky95 commented 3 years ago

Ok so actually, because it is convenient that every event has the type property I will create a custom class for athleticEvent. There will be another class called athleticsPointsEvent which will be the event when it is to be sent to CalculatorView.

So, for now, I want to have a json file containing all the events from decathlon and heptathlon, at the execution of the app, the app will read the file and generate a list of all events to be accessed throughout the app (EnvironmentObject? or static property, or maybe a environmentobject like an eventHelper that when init generates the formulae points and the event list and has methods for dev to access) as well as the points thing. So:

blonsky95 commented 3 years ago

Ok so far so good, next do a couple with women, and then do all the rest for dec and hep

So it will have 6 coefficients, 3 for male, and 3 for female - when getting points it checks sSex and uses one or the other

think about consequences if I have events with only male

Do a check for calculator and see if it gets points for combined events ok

blonsky95 commented 3 years ago

Ok all the points is done, now need to do women heptathlon, and then the indoor events for women and men

I used the @Binding wrapper to send a state variable to a underlying struct, in that struct I mark that as Binding and then when it is sent as param to the struct it has the $, so when the underlying struct makes changes to the var, it reports up to parent struct. I guess you can continue this down enlazando binding and state variables.

I can then add .onChanged modifier to the underlying struct so when the state variable changes, do something, in this project its used when the text of an events performance is typed, it updates eventPerformance which is the binding/State var. OnChanged detects it and updates the points text to the points that equate to that eventPerformance.

blonsky95 commented 3 years ago

Next

Separate that last struct - DONE Look at ordering files in groups or something so I can order by hierarchy, data model, view. - DONE Captura de pantalla 2021-03-16 a las 17 59 43

Do women and men indoor

blonsky95 commented 3 years ago

DONE

blonsky95 commented 3 years ago

Next would be finding formula points for single events

blonsky95 commented 3 years ago

Alright this guy is the boss https://github.com/MaximMoinat/ScoringTablesIAAF/tree/master/src/main/resources/output

he got the tables and did a second order polynomial regression to get the values

blonsky95 commented 3 years ago

NEXT:

Get one event, test the formula with single event, if it works then design/think the categories, slider or whatever,

How to display all the options, e.g. 4 rows of indoor/outdoor male/female with a slider and all the events

So if we put everything together in same json, we have to add a type and have: combined_events, indoor_f, indoor_m, outdoor_f and outdoor_m. When events get generated at start, they get put in corresponding arrays.

When event selectors working and categories too, do all the maths and add all the events with the points.

That will be it with points.

If anything we will need to add other categories like pentathlon and stuff

blonsky95 commented 3 years ago

Ok, the pickers are added and are easy to work with, UI will need touches but the flow is there

Now next, calculator view has to get points for the event using the new coefficients and formula

blonsky95 commented 3 years ago

Alright making good progress,

The single events are being classified in 4 arrays so the pickers work fine. They do need UI touch though.

Finish all the rest of events of points

blonsky95 commented 3 years ago

INDoor left, then move to next ticket

blonsky95 commented 3 years ago

DONEEEEE - probably have to check them all one by one but yeah

blonsky95 commented 3 years ago

1000m men/women outdoor is wrong - FIX - DONE