diff --git a/kfet/static/kfet/js/kfet.api.js b/kfet/static/kfet/js/kfet.api.js index a655786d..1339f284 100644 --- a/kfet/static/kfet/js/kfet.api.js +++ b/kfet/static/kfet/js/kfet.api.js @@ -165,24 +165,11 @@ class ModelObject { /** * Returns a string value for the model, to use in comparisons - * @see {@link Models.ModelObject.compare|ModelObject.compare} + * @see {@link Models.TreeNode.compare|TreeNode.compare} */ comparevalue() { return this.id.toString(); } - - /** - * Compare function between two instances of the model - * by serializing them using comparevalue(). - * @abstract - * @param {a} Models.ModelObject - * @param {b} Models.ModelObject - * @see {@link Models.ModelObject.comparevalue|ModelObject.comparevalue} - */ - static compare(a, b) { - return a.comparevalue().localeCompare(b.comparevalue()); - } - } @@ -552,7 +539,7 @@ class Article extends ModelObject { * @see {@link Models.ModelObject.compare|ModelObject.compare} */ comparevalue() { - return a.name; + return this.name; } // Take care of 'price' type @@ -574,6 +561,13 @@ class TreeNode { this.parent = null; this.children = []; } + + static compare(a, b) { + var a_serial = a.content.comparevalue(); + var b_serial = b.content.comparevalue(); + + return a_serial.localeCompare(b_serial) + } }