<commit_before>'use strict';

angular.module('products.admin').controller('ProductController', ['$scope', '$state', 'Authentication', 'Products',
  function ($scope, $state, Authentication, productResolve) {
    $scope.authentication = Authentication;
    $scope.product = productResolve;

    $scope.find = function() {
      $scope.articles = Products.query();
    };

    $scope.findOne = Products() {
      $scope.article = Articles.get({
        productId: $routeParams.productId
      });
    };

    $scope.create = function(isValid){
      if(!isValid){
        $scope.$broadcase('show-errors-check-validity', 'productForm');

        return false;
      }

      // TODO: state go to product form
      var product = new Products({
        title: this.title,
        author: this.author,
        description: this.description,
        price: this.price,
        category: this.category,
        stock: this.stock,
        image: this.image,
        status: this.status
      });

      product.$save(function(response) {
        $location.path('product/' + response._id);
      }, function(errorResponse) {
        $scope.error = errorResponse.data.message;
      });
    };

    $scope.remove = function (product) {
      if (confirm('Are you sure you want to delete this product?')) {<commit_msg>fixing prod controller<commit_after>'use strict';

angular.module('products.admin').controller('ProductController', ['$scope', '$state', 'Authentication', 'Products',
  function ($scope, $state, Authentication, productResolve) {
    $scope.authentication = Authentication;
    $scope.product = productResolve;

    $scope.create = function(isValid){
      if(!isValid){
        $scope.$broadcase('show-errors-check-validity', 'productForm');

        return false;
      }

      // TODO: state go to product form
      
    };

    $scope.remove = function (product) {
      if (confirm('Are you sure you want to delete this product?')) {
{'fraction_non_alphanumeric': 0.14388489208633093, 'fraction_numerical': 0.0, 'mean_word_length': 2.8784860557768925, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '137874', 'n_tokens_mistral': 539, 'n_tokens_neox': 531, 'n_words': 122}