Skip to content

Instantly share code, notes, and snippets.

@dlitvakb
Created March 7, 2012 19:23
Show Gist options
  • Select an option

  • Save dlitvakb/1995289 to your computer and use it in GitHub Desktop.

Select an option

Save dlitvakb/1995289 to your computer and use it in GitHub Desktop.
is_mismatch: function (alert) {
return alert.alert_tyoe === "listing_mismatch";
},
is_info_missing: function (alert) {
return alert.alert_type === "listing_info_missing";
},
has_mismatch: function () {
var that = this;
return _.any(this.alerts, function (alert) {
return that.is_mismatch(alert);
});
},
has_info_missing: function () {
var that = this;
return _.any(this.alerts, function (alert) {
return that.is_info_missing(alert);
});
},
has_location_mismatch: function () {
if (this.has_mismatch() || this.has_info_missing()) {
return _.any(this.alerts, function (alert) {
return _.any(alert.alert_data.info_type, function (mismatch) {
return _.indexOf(['street_number', 'route', 'city', 'state', 'postal_code'],
mismatch) != -1;
});
});
}
return false;
},
has_contact_info_mismatch: function () {
if (this.has_mismatch() || this.has_info_missing()) {
return _.any(this.alerts, function (alert) {
return _.any(alert.alert_data.info_type, function (mismatch) {
return _.indexOf(['url', 'email','phone', 'fax'],
mismatch) != -1;
});
});
}
return false;
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment