<commit_before>
require('../components/validated-payment-form-component');

App.ValidatedPaymentFormCheckoutComponent = App.ValidatedPaymentFormComponent.extend({

  credits: Ember.computed.alias('currentUser.walletBalance'),
  total: Ember.computed.alias('currentUser.nextBox.total'),
  showPaymentForm: true,

  creditsCoverTotal: function () {
    return this.get('credits') > this.get('total');
  }.property('credits', 'total'),

  // For some reason, property does not work here,
  // so we add an observer below.
  watchSkipPaymentMethod: function () {
    if (this.get('creditsCoverTotal')) {
      this.set('showPaymentForm', !this.get('skipPaymentMethod'));
    } else {
      this.set('showPaymentForm', true);
    }
  }.observes('skipPaymentMethod', 'creditsCoverTotal', 'user.isLoggedIn'),

  skipPaymentMethod: function () {
    return parseInt(this.get('user.createSubscriptionAction.skipPaymentMethod'));
  }.property('user.createSubscriptionAction.skipPaymentMethod'),

  walletBalance: function () {
    var walletBalance = this.get('credits') > 0;
    return walletBalance;
  }.property('credits')

});
<commit_msg>Refined walletBalance and creditsCoverTotal logic<commit_after>
require('../components/validated-payment-form-component');

App.ValidatedPaymentFormCheckoutComponent = App.ValidatedPaymentFormComponent.extend({

  walletBalance: Ember.computed.alias('currentUser.walletBalance'),
  total: Ember.computed.alias('currentUser.nextBox.total'),
  showPaymentForm: true,
  creditsCoverTotal: false,

  // For some reason, property does not work here,
  // so we add observers below.
  watchSkipPaymentMethod: function () {
    if (this.get('creditsCoverTotal')) {
      this.set('showPaymentForm', !this.get('skipPaymentMethod'));
    } else {
      this.set('showPaymentForm', true);
    }
  }.observes('skipPaymentMethod', 'creditsCoverTotal', 'user.isLoggedIn'),

  watchCreditsAndTotal: function () {
    this.set('creditsCoverTotal', this.get('walletBalance') > this.get('total'));
  }.observes('walletBalance', 'total'),

  skipPaymentMethod: function () {
    return parseInt(this.get('user.createSubscriptionAction.skipPaymentMethod'));
  }.property('user.createSubscriptionAction.skipPaymentMethod'),

  hasWalletBalance: function () {
    return this.get('walletBalance') > 0;
  }.property('credits')

});

{'fraction_non_alphanumeric': 0.14682031583440033, 'fraction_numerical': 0.0008536064874093043, 'mean_word_length': 5.2175066312997345, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1085324', 'n_tokens_mistral': 695, 'n_tokens_neox': 693, 'n_words': 116}