sjsakib / cfviz

Visualizes user data from codeforces.com using the official API
http://cfviz.netlify.com
1.12k stars 71 forks source link

Exclude existing user, fix getSeed overcounting bug #16

Closed user202729 closed 5 years ago

user202729 commented 5 years ago
  1. There are some variables assigned to without var. They can be detected with 'use strict';.
  2. The JS sort function is usually faster than bubble sort (currently the bubble sort doesn't take much time) and also shorter.
  3. Currently getSeed computes, assuming that the user with rating rating is not included in contestants. If they're included, then it's necessary to subtract the win probability from the result.
  4. While the website says that it can compute both "your rating change if you participated in a contest live rather than virtual" and "if you could solve one more problem in the last contest", it gives wrong result in the latter case. It's necessary to remove the "real" user from the list to get the correct result.

In the old version, with contest ID 1205, the rating change of Benq is computed to be +8 while the real result is -4. In the new version, all the computed rating change for that contest are correct.

The description for some fields are a bit long (and may not fit in the box on some smaller screen), but I don't know how to fix it.

sjsakib commented 5 years ago

@user202729 are you sure old rating can be derived from ratingsDict. Last time I worked with CF API , contest.ratingChanges returns only users who participated in a given contest.

user202729 commented 5 years ago

Originally, the main feature I want is excluding user (that gives more accurate rating calculation). The old rating computation is just a nice side effect.

I may give an error (cannot calculate old rating for users who did not participate in the contest), or get the user' rating change and deduce it.

Also, I wrote that "leave the handle empty if you did not participate in the contest".

sjsakib commented 5 years ago

Okay. Then change deduced from handle if empty to leave empty if you participated maybe? I think that would be more accurate. And also can you write a proper validation function to check if the use has entered enough data for calculation and show proper error message instead of just All fields required? Since all fields are not required anymore.

And finally change the sw.js file to change revision of the files you modified.

user202729 commented 5 years ago

About validation:

Before the change, it would be valid to leave the penalty field empty (although that's not documented). Now it isn't.

I tested using required HTML attribute, but it always show the "not valid" error message instead of only on clicking calculate.