<commit_before>angular.module('doubtfire.groups.partials.group-selector-directive', [])

.directive('groupSelector', ->
  restrict: 'E'
  templateUrl: 'groups/partials/templates/group-selector.tpl.html'

  controller: ($scope, alertService, Group) ->
    # pagination of groups
    $scope.currentPage = 1
    $scope.maxSize = 5
    $scope.pageSize = 5

    # initial sort orders
    $scope.groupSortOrder = 'name'

    $scope.addGroup = (name) ->
      if $scope.unit.tutorials.length == 0
        alertService.add("danger", "Please ensure there is at least one tutorial before groups are created", 6000)
      if $scope.project #in a student context
        tutorial_id = $scope.project.tutorial.id
      else #convenor/tutor
        tutorial_id = _.find $scope.unit.tutorials, (tutorial) -> tutorial.tutor.id == $scope.assessingUnitRole.id
        if not tutorial_id
          tutorial_id = $scope.unit.tutorials[0].id
          $scope.staffFilter = 'all'
        else
          tutorial_id = tutorial_id.id<commit_msg>fix add groups to use tutor name as id not available to tutor accounts<commit_after>angular.module('doubtfire.groups.partials.group-selector-directive', [])

.directive('groupSelector', ->
  restrict: 'E'
  templateUrl: 'groups/partials/templates/group-selector.tpl.html'

  controller: ($scope, alertService, Group) ->
    # pagination of groups
    $scope.currentPage = 1
    $scope.maxSize = 5
    $scope.pageSize = 5

    # initial sort orders
    $scope.groupSortOrder = 'name'

    $scope.addGroup = (name) ->
      if $scope.unit.tutorials.length == 0
        alertService.add("danger", "Please ensure there is at least one tutorial before groups are created", 6000)
      if $scope.project #in a student context
        tutorial_id = $scope.project.tutorial.id
      else #convenor/tutor
        tutorial_id = _.find $scope.unit.tutorials, (tutorial) -> tutorial.tutor_name == $scope.assessingUnitRole.name
        if not tutorial_id
          tutorial_id = $scope.unit.tutorials[0].id
          $scope.staffFilter = 'all'
        else
          tutorial_id = tutorial_id.id
{'fraction_non_alphanumeric': 0.11554921540656206, 'fraction_numerical': 0.008559201141226819, 'mean_word_length': 3.0076190476190474, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '138779', 'n_tokens_mistral': 676, 'n_tokens_neox': 647, 'n_words': 150}