Sorry for not updating anything for such a long time, but doing additional stats in the profile took much more time, that I was hoping for. To create the stats, I had to set up a server and finding a suitable one (and free, if possible) was quite a challenge. I have tested at least 10 different hostings and each and every one of them had some important limits (like no cron jobs, no cron jobs on a specified time, db limited to 30MB or just being very, very slow). I've tried some combined solutions, when one server was doing some part of the job and other was doing something else (e.g. one for cron, one for interaction with users). But only about a week ago I found something, that, as of now, looks great - feedia.co. I didn't know that hosting before, so I found it almost by accident. I don't know, what is "wrong" with them, but their free hosting service looks better, than many other premium hostings Hopefully, it will stay like that forever
So, I was finally able to do:
in which I:
FIXED problems with recent changes in Accuracy History (and those NaNs)
FIXED problem, when a bar in the Accuracy History could change its height, but not color
ADDED admin reaps as a separate category in the History
CHANGED bar colors, so now both scythe and reap have their colors the same as in the EW or as in user settings, if somebody's using @crazyman4865's script to customize the colors
ADDED additional statistics in the user Profile
CLEANED the code to pass JSHint for ES6 compatibility
Here's how the new statistics should look like:
As you might see, there are 3 tabs at the top. The first one (current) shows the normal statistics, next one is previous, which shows our results from yesterday, last week and last month. The third tab (best) shows our personal records. CAUTION: those are not all-time bests, just best results since installing the script (well, number of points and number of cubes will be from about when the current version of the script is released), because simply I don't have access to all time bests and I'm not sure, if I want it, because some might not like me having so much data. xD
In the lower part of the Profile window there are also 3 tabs and a graph.
The graph shows our numbers of points, cubes, trailblazes, scythes and completes. Changing the tabs over the graph changes time range of the graph. The graph shows only data for already ended units of time (e.g. for last 7 days, the newest point in the graph will be yesterday, for last 10 weeks - last week, for last 12 months - last month). The Y axis on the left is common for the number of cubes, trailblazes, scythes/reaps and completed. The one on the right is for points.
Clicking on someone's profile won't show the new statistics (although, there might be a short glitch during extended stats will be visible, but those are our own stats, because both our and others' profile is shown in the same window). The reason for that is, because I didn't want to allow anybody to stalk anyone else xD
Here's how the data collecting works:
Number of points and number of cubes are collected everyday at 23:59 EST/EDT via a cron job. These numbers are collected for all the players (no matter, if someone has or hasn't the script installed), because it will also be used for an extenion for the original Stats window (the one with the map).
As for the other data (trailblazes, scythes and completes) things are a little bit more complicated. After each tbing, scything or completing, the data is collected from the EW server. To be precise the data is collected 15 s after each of the operations. If another operation is done within that time, the counter is reset. In other words: data is collected from EW server after 15s after the last successful operation. This is done to not unnecessary increase the traffic to the EW server when one makes one tb after another or a series of scything and completing.
The data for the current day, week and month is collected in the localStorage (on user's computer). When the browser and the EW page is loaded another day, the first thing is to send all the data for each past period to the server and then the previous and the best data is downloaded from the server. This is also the moment, when the data for the graphs is downloaded from the server.
-you play however you like and the data is collected in the localStorage,
-you refresh the EW page or reopen the browser or turn off the computer and turn it on the next day or any other day,
-after the page has been loaded, the script checks if current (hq time) date is the same as the date of last update from the script server (the date of the last update is also stored in the localStorage).
-- if the dates are the same, no update, neither on the client, nor on the server, side is performed,
-- if the dates are different, the data from the client is sent to server and the server returns updated previous, best and charts data
- date of the last update in the localStorage is set to today's date.
Don't worry, if you don't play everyday or use more than one browser profile/browser/device to play EW. If the script is installed on every device, you play, everything should work ok (if not, some data might be missing).
So, if you have played for some time of a day on one computer, then changed to some other, the first one will have older data, than the latter. If on the next day you first run the first computer then the second, then the data for then-yesterday will be first updated from the first computer, then from the second one. If you first run the second computer, then the first one, the data from the second computer will be sent to server and then also the data from the first computer will be sent to the server, but because the data from the first computer has smaller values (you have played on it earlier the previous day), it won't be written to the db.
During the development I had a lot of recurring bugs. I hope, I fixed them all, but spes mater stultorum, lol.
If you find anything wrong, please report it here or on the chat, while I'm online. But, for a few days, I will be fixing only blockers and security holes, because I really want to add the ability to display Stats (the one with the map) for a custom period (the button for that is already in the script, but it doesn't do anything now) before the New Year.
The script currently consists of about:
400 lines of SQL
300 lines of PHP
600 lines of CSS
3400 lines of JS