<commit_before>angular.module 'NotSoShitty.settings'
.controller 'ProjectCtrl', (
  $location
  $scope
  $timeout
  $q
  boards
  TrelloClient
  localStorageService
  $mdToast
  Project
  user
) ->
  $scope.boards = boards
  if user.project?
    project = user.project
  else
    project = new Project()

  $scope.project = project

  fetchBoardData = (boardId) ->
    $q.all [
      # the the list of columns
      TrelloClient.get("/boards/#{boardId}/lists")
      .then (response) ->
        $scope.boardColumns = response.data
      .catch (err) ->
        $scope.project.boardId = null
        console.warn "Could not fetch Trello board with id #{boardId}"
        console.log err

      # get the list of users
      TrelloClient.get("/boards/#{boardId}/members?fields=avatarHash,fullName,initials,username")
      .then (response) ->
        $scope.boardMembers = response.data
      .catch (err) ->
        $scope.project.boardId = null
        console.warn "Could not fetch Trello board members"
        console.log err

      # find if there is already a project for this board
      # otherwise create one
      Project.get boardId
      .then (response) ->
        return response if response?

        console.log "No project with boardId #{boardId} found. Creating a new one"
        project = new Project()
        project.boardId = boardId
        project.team =
          rest: []
          dev: []
        project.save()
      .then (project) ->
        $scope.project = project
    ]


  if $scope.project.boardId?
    fetchBoardData $scope.project.boardId

  # Get board colums and members when board is set
  $scope.$watch 'project.boardId', (next, prev) ->
    return unless next? and next != prev
    fetchBoardData next

  $scope.$watch 'project.team', (next, prev) ->
    return unless next? and  not angular.equals next, prev
  , true

  $scope.clearTeam = ->
    $scope.project.team.rest = []
    $scope.project.team.dev = []
    $scope.save()
  #
  saveFeedback = $mdToast.simple()
    .hideDelay(1000)
    .position('top right')
    .content('Saved!')

  promise = null
  $scope.save = ->
    return unless $scope.project.boardId?
    $scope.project.save().then (p) ->
      user.project = p
      user.save().then ->
        $mdToast.show saveFeedback
        $location.path '/sprint/current'
  return
<commit_msg>PR feedbacks<commit_after>angular.module 'NotSoShitty.settings'
.controller 'ProjectCtrl', (
  $location
  $scope
  $timeout
  $q
  boards
  TrelloClient
  localStorageService
  $mdToast
  Project
  user
) ->
  $scope.boards = boards
  if user.project?
    project = user.project
  else
    project = new Project()

  $scope.project = project

  fetchBoardData = (boardId) ->
    $q.all [
      # the the list of columns
      TrelloClient.get("/boards/#{boardId}/lists")
      .then (response) ->
        $scope.boardColumns = response.data
      .catch (err) ->
        $scope.project.boardId = null
        console.warn "Could not fetch Trello board with id #{boardId}"
        console.log err

      # get the list of users
      TrelloClient.get("/boards/#{boardId}/members?fields=avatarHash,fullName,initials,username")
      .then (response) ->
        $scope.boardMembers = response.data
      .catch (err) ->
        $scope.project.boardId = null
        console.warn "Could not fetch Trello board members"
        console.log err

      # find if there is already a project for this board
      # otherwise create one
      Project.get boardId
      .then (response) ->
        return response if response?

        console.log "No project with boardId #{boardId} found. Creating a new one"
        project = new Project()
        project.boardId = boardId
        project.team =
          rest: []
          dev: []
        project.save()
      .then (project) ->
        $scope.project = project
    ]

  if $scope.project.boardId?
    fetchBoardData $scope.project.boardId

  $scope.clearTeam = ->
    $scope.project.team.rest = []
    $scope.project.team.dev = []
    $scope.save()

  saveFeedback = $mdToast.simple()
    .hideDelay(1000)
    .position('top right')
    .content('Saved!')

  promise = null
  $scope.save = ->
    return unless $scope.project.boardId?
    $scope.project.save().then (p) ->
      user.project = p
      user.save().then ->
        $mdToast.show saveFeedback
        $state.go 'current-sprint'
  return

{'fraction_non_alphanumeric': 0.11794171220400729, 'fraction_numerical': 0.0018214936247723133, 'mean_word_length': 2.310474755086662, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 29, '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': '2487763', 'n_tokens_mistral': 1353, 'n_tokens_neox': 1322, 'n_words': 339}