adding documentation

This commit is contained in:
Stuardo Rodríguez 2013-01-14 11:44:41 -05:00
parent 0133d1da58
commit 199bf4d380

View File

@ -23,6 +23,8 @@ var Community = function(id) {
/**
* Bubble sort mechanism
*
* if both restaurants are open or both are closed, use sort value.
*
* if a < b, returns negative
* if a = b, returns zero
* if a > b returns positive
@ -30,8 +32,7 @@ var Community = function(id) {
* @return int
*/
self.__restaurants.sort(function(a, b) {
var bubble; // = (b._open ? 1 : 0) - (a._open ? 1 : 0);
console.log(a);
var bubble;
if ((a.open() && b.open()) || (!a.open() && !b.open())) {
bubble = parseInt(a.sort) - parseInt(b.sort);
} else if (a.open() && !b.open()) {