This job is to create on java class which will calculate the placement of a list item in a row and how many minutes they are behind compare to the person in front of them.
To calculate this we need to query again the scores table. This time we need to obtain all of the racer of the same class.
In the Excel file you have attached, their is a list of object "scoresBean.java", each excel row should be represented as one scoresBean.java object. The Excel spread sheet rows are sorted in order where the last row is the most recent score received.
(Not all the fields of ScoreBean.java are present but only those fileds will be require to do the work)
The new class you will create should have a method that will accept an array of scoresBean.
This method you will create should return an object with all the scoresBean received listed in order of placement and how many minutes (See the time format of ScoresBean excel document) each row is behind each other.
Each object that is return in the returned array will have to have the ScoreBean, Int placement, String timeBehind, StringTotalTime;
For the following let's assume dataSetAllScoreClass is the list of object containing one ScoreBean per row.
The first row at dataSetAllScoreClass(0) will be the last score received.
You will need to keep the riderId information from that first row.
currentRider = dataSetAllScoreClass(0).riderId
Then you need to calculate the placement of each rider.
To calculate that you need to count how many rows you have for each riderId, if you have 10 rows for riderId=X then this rider has the most laps and he is in Placement = 1.
Then the rider with 9 laps will be in placement = 2.
Once you have figured out the placement of each rider then you will need to retrieve the placement of each rider.
Then you need to calculate how much time is each rider behind the rider in front of them him.
as an example: Rider placement = 5 then the rider in front is the rider with placement 4.
Then you must retrieve the lastest score time of the rider with placement 4.
The you will take the score of the rider that is in position 4th and calculate the difference with the current rider that is in positon 5.
It would be rider in Position 4 score time, minus currentRider (position 5) score time. This will give you the difference between the last time scanned for position 4 and the last time scan for position 5, and it will give you the behind by time.
The racer with placement #1 will have a behind time of zero as this racer is in front of the pack, and he is not behind anyone.
You java class must be compatible with Android Studio.
You must provide the Unit Test Class, to show that your logic is working. In your unit test class you must use the data provided in the Excel file.
March 3, 2018
I am looking for freelancers with the lowest rates