<< Back to Ladder Forum   Search

Posts 1 - 8 of 8   
graphs: 9/3/2013 11:02:21


Vladimir Vladimirovich 
Level 61
Report
what happened to the player's history graphs?
graphs: 9/3/2013 12:50:38


Green 
Level 56
Report
I presume it's a bug as the templates for them are still there if you use the inspect element function. Since I hadn't seen a thread about it I presumed the problem lay at my end. Now, however, it seems the damage is more widespread.

I'm using 64bit windows 7 with firefox and chrome - does this problem exist for Mac/Linux or IE users?
graphs: 9/3/2013 13:24:19

Dom365 
Level 67
Report
Just discovered the same.

Really, really hope this isn't an "update"!
graphs: 9/3/2013 13:34:13


Ska2D2 
Level 55
Report
It doesn't show up on Opera or Firefox either currently or silk.
graphs: 9/4/2013 12:25:00


Vladimir Vladimirovich 
Level 61
Report
i dont feel like looking for the report bug area, so i will insist on this till fizzer reads it
graphs: 9/4/2013 15:52:21


Ⓖ. Ⓐrun 
Level 57
Report
There is a tab called 'Help'...

http://warlight.net/ReportBug
graphs: 9/4/2013 16:59:32

Grzechooo 
Level 32
Report
((This post is about some tech things (JavaScript). Feel free to ignore it, otherwise read on.))
I think I know where the bug lies. There's a bunch of JS building the data to be used by plotter. It works by taking original data and re-formatting it to the format used by the plotter. The original data looks more or less like this:
<ordinal number> 5 <ladder points count>; (...)

(note: I have no idea what this 5 does.)



To reformat this into the format used by plotter, there exists a JS function called BuildPoints. It looks like this:
function BuildPoints(d) {
    var r = [];
    var start = LadderHistoryData.StartDate().getTime();
    var points = LadderHistoryData.Points().split(';');
    for (var p in points) {
        var s = points[p].split(' ');

        var point = s[d] - 0;

        if (point == 2000000000)
            continue;

        r.push([
            new Date(s[0] * 24 * 60 * 60 * 1000 + start), 
            point]);
    }
    return r;
}

("d" is "i" in original code, but I had to change it for the formatting not to break. It can be either 1 or 2.)



If you know JavaScript, you should know that the for ... in construct iterates over object properties. In this case, the object is an array. However, something (I haven't found out what) adds a function property, called "remove", something like this lies somewhere:
Array.prototype.remove = function() {
	var what,
		a = arguments,
		L = a.length,
		ax;
	while (L && this.length) {
		what = a[--L];
		while ((ax = this.indexOf(what)) !== -1) {
			this.splice(ax, 1);
		}
	}
	return this;
}

(note: this is a prettified version, created by Opera Dragonfly.)



The net result is, the for ... in construct iterates over the "remove" function, which obviously doesn't have the "split" function attached to it, resulting in a TypeError, breaking the entire graph.
The fix? It's simple: iterate only over the own properties of an array, using the hasOwnProperty function of an object. Something like this should suffice:

function BuildPoints(d) {
    var r = [];
    var start = LadderHistoryData.StartDate().getTime();
    var points = LadderHistoryData.Points().split(';');
    for (var p in points) {
        if (points.hasOwnProperty(p)) {
            var s = points[p].split(' ');

            var point = s[d] - 0;

            if (point == 2000000000)
                continue;

            r.push([
                new Date(s[0] * 24 * 60 * 60 * 1000 + start), 
                point]);
        }
    }
    return r;
}



Sources:


Regards,
Grzechooo
graphs: 9/4/2013 17:48:22

Fizzer 
Level 64

Warzone Creator
Report
This is fixed now. Thanks for the detailed analysis!
Posts 1 - 8 of 8