function isCardDirty(card, originalCard) {
  // The rules:
  //   - if it's new, then it's dirty when
  //       1) there is a database/table chosen or
  //       2) when there is any content on the native query
  //   - if it's saved, then it's dirty when
  //       1) the current card doesn't match the last saved version

  if (!card) {
    return false;
  } else if (!card.id) {
    if (card.dataset_query.query && card.dataset_query.query["source-table"]) {
      return true;
    } else if (
      card.dataset_query.native &&
      !_.isEmpty(card.dataset_query.native.query)
    ) {
      return true;
    } else {
      return false;
    }
  } else {
    const origCardSerialized = originalCard
      ? serializeCardForUrl(originalCard)
      : null;
    const newCardSerialized = card
      ? serializeCardForUrl(_.omit(card, "original_card_id"))
      : null;
    return newCardSerialized !== origCardSerialized;
  }
}
// predicate function that dermines if a given card is "dirty" compared to the last known version of the card
predicate function that dermines if a given card is "dirty" compared to the last known version of the card
predicate function that dermines if a given card is " dirty " compared to the last known version of the card
function isCardDirty(card, originalCard) {
  if (!card) {
    return false;
  } else if (!card.id) {
    if (card.dataset_query.query && card.dataset_query.query["source-table"]) {
      return true;
    } else if (
      card.dataset_query.native &&
      !_.isEmpty(card.dataset_query.native.query)
    ) {
      return true;
    } else {
      return false;
    }
  } else {
    const origCardSerialized = originalCard
      ? serializeCardForUrl(originalCard)
      : null;
    const newCardSerialized = card
      ? serializeCardForUrl(_.omit(card, "original_card_id"))
      : null;
    return newCardSerialized !== origCardSerialized;
  }
}
function isCardDirty ( card , originalCard ) { if ( ! card ) { return false ; } else if ( ! card . id ) { if ( card . dataset_query . query && card . dataset_query . query [ "source-table" ] ) { return true ; } else if ( card . dataset_query . native && ! _ . isEmpty ( card . dataset_query . native . query ) ) { return true ; } else { return false ; } } else { const origCardSerialized = originalCard ? serializeCardForUrl ( originalCard ) : null ; const newCardSerialized = card ? serializeCardForUrl ( _ . omit ( card , "original_card_id" ) ) : null ; return newCardSerialized !== origCardSerialized ; } }
predicate function that dermines if a given card is "dirty" compared to the last known version of the card
predicate function that dermines if a given card is " dirty " compared to the last known version of the card
// The rules: //   - if it's new, then it's dirty when //       1) there is a database/table chosen or //       2) when there is any content on the native query //   - if it's saved, then it's dirty when //       1) the current card doesn't match the last saved version