Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Player Graph is Not Displayed for Some Players Due to Error on Ratings Endpoint #42

Open
vash3g opened this issue Mar 12, 2016 · 7 comments
Labels
bug Bugs in our AGAGD system.
Projects

Comments

@vash3g
Copy link
Member

vash3g commented Mar 12, 2016

Player has no graph so far, played in same number of tournaments as other club members.
No graph: http://agagd.usgo.org/player/17440/

Has graph, same time period, same number of games
http://agagd.usgo.org/player/22183/

@leeschumacher
Copy link
Contributor

xhr request to http://agagd.usgo.org/ratings/17440/ returns:
[
{
"elab_date": null,
"sigma": 0.0,
"rating": 0.0
},
{
"elab_date": "2015-10-24",
"sigma": 1.0425,
"rating": -2.0423800000000001
},
{
"elab_date": "2016-01-09",
"sigma": 0.75205,
"rating": 2.9282699999999999
},
{
"elab_date": "2016-02-13",
"sigma": 0.56854000000000005,
"rating": 2.8661699999999999
}
]

that null date in the first entry causes the graph render to fail. The script could protect itself against that, but the data should also be cleaned up.

@JonathanBresler
Copy link

The database table, Ratings, contains ratings and sigmas generated by the
C++ program that we currently use as well as ratings and sigmas that were
generated by Paul Matthews program. For the previous progra, we do not
have dates or the tournament that was used to calculate the ratings and
sigmas. Indeed, during that period, ratings were run once a month or once
a quarter so that there was not a mapping between ratings and individual
tournaments. As a result, the Tournament_Code for those ratings and
sigmas. Consequently the dates are '0000-00-00', a date that does not
exist and the Tournament_Code is NULL. These are the equivalent of NaN in
numerical calculations.

If you know of a way that we can "clean up the data" I would be interested
in hearing it. Perhaps we could then do so.

Jonathan

mysql> select * from ratings where Pin_Player = 17440 order by Elab_Date ;
+------------+----------+---------+------------+-----------------+
| Pin_Player | Rating | Sigma | Elab_Date | Tournament_Code |
+------------+----------+---------+------------+-----------------+
| 17440 | 0.00000 | 0.00000 | 0000-00-00 | NULL |
| 17440 | -2.04238 | 1.04250 | 2015-10-24 | roch20151024 |
| 17440 | 2.92827 | 0.75205 | 2016-01-09 | ngc20160109 |
| 17440 | 2.86617 | 0.56854 | 2016-02-13 | roch20160213 |
+------------+----------+---------+------------+-----------------+
4 rows in set (0.00 sec)

mysql>

On Sat, 19 Mar 2016, Lee wrote:

xhr request to http://agagd.usgo.org/ratings/17440/ returns:
[
{
"elab_date": null,
"sigma": 0.0,
"rating": 0.0
},
{
"elab_date": "2015-10-24",
"sigma": 1.0425,
"rating": -2.0423800000000001
},
{
"elab_date": "2016-01-09",
"sigma": 0.75205,
"rating": 2.9282699999999999
},
{
"elab_date": "2016-02-13",
"sigma": 0.56854000000000005,
"rating": 2.8661699999999999
}
]

that null date in the first entry causes the graph render to fail. The script could protect itself against that, but the data should also be cleaned up.


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#42 (comment)

@leeschumacher
Copy link
Contributor

So, i'm not familiar with the code that generates the ratings/sigma from the data, that record doesn't look like it has a meangingful rating or sigma value either so just deleting it would solve their problem. The other approaches would be to fix the code that generates the json to filter out those values (since without a meaningful date you couldn't graph it anyway), and/or fix the js to ignore those values.

@JonathanBresler
Copy link

Let's focus for a moment on a specific example.
Which player's information should we look at to see the issue.

Jonathan

On Sat, 26 Mar 2016, Lee wrote:

So, i'm not familiar with the code that generates the ratings/sigma from the data, that record doesn't look like it has a meangingful rating or sigma value either so just deleting it would solve their problem. The other approaches would be to fix the code that generates the json to filter out those values (since without a meaningful date you couldn't graph it anyway), and/or fix the js to ignore those values.


You are receiving this because you commented.
Reply to this email directly or view it on GitHub:
#42 (comment)

@leeschumacher
Copy link
Contributor

How about http://agagd.usgo.org/ratings/17440/ ?

@vash3g vash3g added the bug Bugs in our AGAGD system. label Jul 25, 2019
@michaelhiiva michaelhiiva added this to Needs Triage in Triage Aug 1, 2020
@vash3g vash3g moved this from Needs Triage to Low Priority in Triage Aug 1, 2020
@michaelhiiva
Copy link
Contributor

It seems the code responsible for this is not checking invalid dates i.e., null, or 0000-00-00

def member_ratings(request, member_id):
#returns a members rating data as a json dict for graphing
try:
player = Member.objects.get(pk=member_id)
ratings = player.ratings_set.all().order_by('elab_date')
ratings_dict = [
{'sigma': r.sigma,
'elab_date': r.elab_date,
'rating': r.rating} for r in ratings
if r.elab_date != None]
if len(ratings_dict) <= 1:
logger.debug('Ratings error: only one rating')
return JsonResponse({
'result': 'error',
'message': 'Only one rated game. Not enough data'
})
return JsonResponse(ratings_dict)
except:
logger.debug('Ratings error', exc_info=1)
return JsonResponse({'result':'error'})

@michaelhiiva
Copy link
Contributor

Both players now have graphs:

https://agagd.usgo.org/player/17440/

image

http://agagd.usgo.org/player/22183/

image

However, for older ratings we are just seeing a json error. ie.,

https://agagd.usgo.org/ratings/7/

{
  "result": "error"
}

https://agagd.usgo.org/player/7/
image

https://agagd.usgo.org/ratings/1/

{
  "result": "error"
}

https://agagd.usgo.org/player/1/
image

In these cases, I think we should have the graph indicate that there is some issue with creation or that there is not enough data to display a graph.

@michaelhiiva michaelhiiva changed the title No player graph for player Player Graph is Not Displayed for Some Players and Results Due to Error on Ratings Endpoint Oct 12, 2020
@michaelhiiva michaelhiiva changed the title Player Graph is Not Displayed for Some Players and Results Due to Error on Ratings Endpoint Player Graph is Not Displayed for Some Players Due to Error on Ratings Endpoint Oct 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bugs in our AGAGD system.
Projects
Triage
  
Low Priority
Development

No branches or pull requests

4 participants