GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( da5f76...59bb8c )
by Keith
76:35
created

demo/v2/js/controller/44create-staff-profile.js   A

Complexity

Total Complexity 13
Complexity/F 1.63

Size

Lines of Code 81
Function Count 8

Duplication

Duplicated Lines 81
Ratio 100 %

Importance

Changes 0
Metric Value
eloc 40
dl 81
loc 81
rs 10
c 0
b 0
f 0
wmc 13
mnd 5
bc 5
fnc 8
bpm 0.625
cpm 1.625
noi 1

1 Function

Rating   Name   Duplication   Size   Complexity  
A 44create-staff-profile.js ➔ Initialize 8 8 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1 View Code Duplication
"use strict";
2
  app.controller('staffProfileCreateController', ['$scope', '$element', function ($scope, $element, $rootScope) {
3
      function Initialize(){
4
		  var entryForm = {};    
5
		  $scope.entryForm = entryForm;
6
		  $scope.directiveDict = {};
7
8
		  $scope.deptEditBox = {};
9
		  $scope.sectionEditBox = {};
10
      }
11
      Initialize();
12
13
      $scope.SetDefaultValue = function(scope, iElement, iAttrs, controller){
14
          // controller.ngModel.StaffID = "";
15
          controller.ngModel.LastName = "Peter";
16
          controller.ngModel.FirstName = "Pan";
17
          // controller.ngModel.ChineseName = "";
18
19
          //controller.ngModel.Birthday = new Date(0, 0, 0);
20
		  controller.ngModel.Birthday = null
21
          controller.ngModel.EmploymentDate = new Date();
22
      }
23
24
    $scope.StatusChange = function(fieldName, newValue, newObj, scope, iElement, iAttrs, controller){
25
        if(fieldName == "StaffID")
26
            newObj.StaffID = newObj.StaffID.toUpperCase(); 
27
    }
28
29
    $scope.EventListener = function(scope, iElement, iAttrs, controller){
30
      console.log("<"+iElement[0].tagName+">" +" Directive overried EventListener()");
0 ignored issues
show
Debugging Code introduced by
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
31
      var prgmID = scope.programId;
32
      var tagName = iElement[0].tagName.toLowerCase();
33
      var editMode = "";
34
35
      if(tagName == "entry") editMode = iAttrs.editMode;
36
37
      console.log(tagName)
38
      var varName = prgmID;//tagName + prgmID + editMode;
39
      varName = varName.toLowerCase();
40
41
      if($scope.directiveDict[varName] == null || typeof($scope.directiveDict[varName]) == "undefined"){
42
        $scope.directiveDict[varName] = scope;
43
      }
44
45
      // console.dir(scope);
46
      // console.dir(iElement);
47
      // console.dir(iAttrs);
48
      // console.dir(controller);
49
50
      //http://api.jquery.com/Types/#Event
51
      //The standard events in the Document Object Model are:
52
      // blur, focus, load, resize, scroll, unload, beforeunload,
53
      // click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave,
54
      // change, select, submit, keydown, keypress, and keyup.
55
      iElement.ready(function() {
56
57
      })
58
    }
59
60
    $scope.CustomSelectedToRecord = function(sRecord, rowScope, scope, iElement, controller){
61
      var tagName = iElement[0].tagName.toLowerCase();
62
      var prgmID = scope.programId.toLowerCase();
63
64
      if(prgmID == "dw01dp"){
65
        // asign the selected record to ng-model
66
        $scope.entryForm.DeptCode = sRecord.DepartmentCode;
67
      }
68
69
      else if (prgmID == "dw02se"){
70
        $scope.entryForm.SectionCode = sRecord.SectionCode; 
71
      }
72
73
    }
74
75
    $scope.ValidateBuffer = function(scope, iElement, iAttrs, controller){
76
      controller.ngModel.FullName = controller.ngModel.LastName + ' ' +  controller.ngModel.FirstName;
77
78
      return true;
79
    };
80
81
  }]);