<commit_before>angular.module('kassa').controller('ProductDetailCtrl', [
  '$scope'
  'ProductService'
  ($scope, Product)->
    STATE_FAILED = 0
    STATE_SAVED = 1
    STATE_SAVING = 2
    originalProduct = null
    equal = angular.equals

    changed = (product)-> !equal(originalProduct, product)

    cancel = ->
      #copy to prevent any unsaved edits from leaking to server object state
      $scope.product = angular.copy(originalProduct)
      $scope.priceEuro = Math.floor(originalProduct.price)
      $scope.priceCent = (originalProduct.price % 1) * 100

    save = (product)->
      saveSuccess = -> $scope.state = STATE_SAVED
      saveFailure = -> $scope.state = STATE_FAILED
      $scope.state = STATE_SAVING
      Product.update(product).then(setProduct).then saveSuccess, saveFailure

    setProduct = (product)->
      originalProduct = product
      cancel() #sets to default state by copying originalProduct
      product

    updatePrice = (product, euros, cents)->
      console.log 'price before', product.price, typeof product.price
      product.price = euros + cents / 100
      console.log 'price after', product.price, typeof product.price


    Product.currentByRoute().then setProduct
    $scope.changed = changed
    $scope.cancel = cancel
    $scope.save = save
    $scope.updatePrice = updatePrice
    $scope.SAVED = STATE_SAVED
    $scope.FAILED = STATE_FAILED
    $scope.SAVING = STATE_SAVING
])<commit_msg>Remove console.logs from product detail controller<commit_after>angular.module('kassa').controller('ProductDetailCtrl', [
  '$scope'
  'ProductService'
  ($scope, Product)->
    STATE_FAILED = 0
    STATE_SAVED = 1
    STATE_SAVING = 2
    originalProduct = null
    equal = angular.equals

    changed = (product)-> !equal(originalProduct, product)

    cancel = ->
      #copy to prevent any unsaved edits from leaking to server object state
      $scope.product = angular.copy(originalProduct)
      $scope.priceEuro = Math.floor(originalProduct.price)
      $scope.priceCent = (originalProduct.price % 1) * 100

    save = (product)->
      saveSuccess = -> $scope.state = STATE_SAVED
      saveFailure = -> $scope.state = STATE_FAILED
      $scope.state = STATE_SAVING
      Product.update(product).then(setProduct).then saveSuccess, saveFailure

    setProduct = (product)->
      originalProduct = product
      cancel() #sets to default state by copying originalProduct
      product

    updatePrice = (product, euros, cents)->
      product.price = euros + cents / 100

    Product.currentByRoute().then setProduct
    $scope.changed = changed
    $scope.cancel = cancel
    $scope.save = save
    $scope.updatePrice = updatePrice
    $scope.SAVED = STATE_SAVED
    $scope.FAILED = STATE_FAILED
    $scope.SAVING = STATE_SAVING
])
{'fraction_non_alphanumeric': 0.10600071864893999, 'fraction_numerical': 0.007186489399928135, 'mean_word_length': 3.1552238805970148, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '6961214', 'n_tokens_mistral': 837, 'n_tokens_neox': 789, 'n_words': 197}