<commit_before>'use strict';

angular.module('suggestDishApp')
  .controller('SuggestDishCtrl', function ($scope, $resource) {
    $scope.dish = {};
    $scope.hadSubmitted = false;

    $scope.dishImageUpload = function(file, message) {
      var res = JSON.parse(message);
      $scope.dish.imageUrl = res.url;
    };

    $scope.saveSuggestedDish = function(dishForm) {
      $scope.hadSubmitted = true;
      console.log("Form invalid");

      if (dishForm.$valid) {
        var SuggestedDishApi = $resource('/api/suggestedDish');
        var suggestedDish = $scope.dish;

        //TODO: location
        console.log("suggestedDish", suggestedDish);
        var res = SuggestedDishApi.save(suggestedDish, function(resp) {
          console.log("Success", resp);
        });<commit_msg>added TODO<commit_after>'use strict';

angular.module('suggestDishApp')
  .controller('SuggestDishCtrl', function ($scope, $resource) {
    $scope.dish = {};
    $scope.hadSubmitted = false;

    $scope.dishImageUpload = function(file, message) {
      var res = JSON.parse(message);
      $scope.dish.imageUrl = res.url;
    };

    $scope.saveSuggestedDish = function(dishForm) {
      $scope.hadSubmitted = true;
      console.log("Form invalid");

      if (dishForm.$valid) {
        var SuggestedDishApi = $resource('/api/suggestedDish');
        var suggestedDish = $scope.dish;

        //TODO: retrieve location from google places API
        //TODO: reset fields after save
        //TODO: show success and failure message at the top of screen
        console.log("suggestedDish", suggestedDish);
        var res = SuggestedDishApi.save(suggestedDish, function(resp) {
          console.log("Success", resp);
        });
{'fraction_non_alphanumeric': 0.1348053457292272, 'fraction_numerical': 0.0, 'mean_word_length': 2.976905311778291, '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': '6954311', 'n_tokens_mistral': 547, 'n_tokens_neox': 522, 'n_words': 106}