ankitsilaich/shiningfloor

View on GitHub
admin/js/controllers/new_sellerProducts.js

Summary

Maintainability
F
1 wk
Test Coverage

Function findOtherFilters has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    $scope.findOtherFilters = function(index){
      $scope.selectedType = $scope.categoryFilters[index]; 
      console.log($scope.selectedType);
      $http.get('../api/slim.php/shiningfloor/' + $scope.selectedType + '/brands').then(function(resp) {
              $scope.brandFilters = resp.data.brands;
Severity: Minor
Found in admin/js/controllers/new_sellerProducts.js - About 1 hr to fix

Function updateUrlChanges has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

     $scope.updateUrlChanges = function() {

        $location.search("pageNo", '1');        
        if ($scope.brandUrl = $scope.makeUrl($scope.selectedBrands, $scope.brandFilters)) {
            $location.search('brand_name', $scope.brandUrl);
Severity: Minor
Found in admin/js/controllers/new_sellerProducts.js - About 1 hr to fix

Similar blocks of code found in 3 locations. Consider refactoring.
Open

     $scope.updateUrlChanges = function() {

        $location.search("pageNo", '1');        
        if ($scope.brandUrl = $scope.makeUrl($scope.selectedBrands, $scope.brandFilters)) {
            $location.search('brand_name', $scope.brandUrl);
Severity: Major
Found in admin/js/controllers/new_sellerProducts.js and 2 other locations - About 3 days to fix
seller/js/controllers/selected_products.js on lines 86..122
seller/js/controllers/selectproducts.js on lines 110..146

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 651.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    $scope.findOtherFilters = function(index){
      $scope.selectedType = $scope.categoryFilters[index]; 
      console.log($scope.selectedType);
      $http.get('../api/slim.php/shiningfloor/' + $scope.selectedType + '/brands').then(function(resp) {
              $scope.brandFilters = resp.data.brands;
Severity: Major
Found in admin/js/controllers/new_sellerProducts.js and 1 other location - About 3 days to fix
seller/js/controllers/selectproducts.js on lines 216..256

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 649.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 4 locations. Consider refactoring.
Open

    $scope.resetAll = function() {
         
        $scope.selectedCategory = [false];
        for (i = 0; i < $scope.totalBrands; i++)
          $scope.selectedBrands[i] = false;
Severity: Major
Found in admin/js/controllers/new_sellerProducts.js and 3 other locations - About 1 day to fix
admin/js/controllers/edited_sellerProducts.js on lines 304..318
seller/js/controllers/selected_products.js on lines 279..293
seller/js/controllers/selectproducts.js on lines 306..320

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 214.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

 $scope.requestToSearchAPI = function() {
        final='';
        final = $location.url().replace($location.path(), '') ;
       console.log(final);
      $http.get('../api/slim.php/shiningfloor/admin/sellers/newproducts'+ final).then(function(resp) {
Severity: Major
Found in admin/js/controllers/new_sellerProducts.js and 1 other location - About 1 day to fix
admin/js/controllers/edited_sellerProducts.js on lines 154..167

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 202.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

  $scope.selectproduct = function(product){
    //console.log($scope.product);
     
    var data = {
     // sellers_id : id,
Severity: Major
Found in admin/js/controllers/new_sellerProducts.js and 1 other location - About 6 hrs to fix
seller/js/controllers/selectproducts.js on lines 26..53

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 170.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    $scope.findAndRemove = function(array, property, value) {
    var indexno;
   $.each(array, function(index, result) {
      
     if(result[property] == value) {           
Severity: Major
Found in admin/js/controllers/new_sellerProducts.js and 1 other location - About 2 hrs to fix
admin/js/controllers/edited_sellerProducts.js on lines 10..19

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 79.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Identical blocks of code found in 4 locations. Consider refactoring.
Open

   for(i=0;i<$scope.categoryFilters.length ; i++){
      if($scope.selectedCategory[i] == true)
      {    $scope.selectedType = $scope.categoryFilters[i];
         $scope.findOtherFilters(i);
      }
Severity: Major
Found in admin/js/controllers/new_sellerProducts.js and 3 other locations - About 2 hrs to fix
admin/js/controllers/edited_sellerProducts.js on lines 256..261
seller/js/controllers/selected_products.js on lines 232..237
seller/js/controllers/selectproducts.js on lines 259..264

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 78.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 16 locations. Consider refactoring.
Open

    $scope.resetFinishTypes = function() {
        for (i = 0; i < $scope.finish_typesLength; i++)
            $scope.selectedFinishTypes[i] = false;         
     
         $scope.updateUrlChanges();
Severity: Major
Found in admin/js/controllers/new_sellerProducts.js and 15 other locations - About 1 hr to fix
admin/js/controllers/edited_sellerProducts.js on lines 276..281
admin/js/controllers/edited_sellerProducts.js on lines 282..288
admin/js/controllers/edited_sellerProducts.js on lines 289..295
admin/js/controllers/edited_sellerProducts.js on lines 296..302
admin/js/controllers/new_sellerProducts.js on lines 272..277
admin/js/controllers/new_sellerProducts.js on lines 285..291
admin/js/controllers/new_sellerProducts.js on lines 292..298
seller/js/controllers/selected_products.js on lines 251..256
seller/js/controllers/selected_products.js on lines 257..263
seller/js/controllers/selected_products.js on lines 264..270
seller/js/controllers/selected_products.js on lines 271..277
seller/js/controllers/selectproducts.js on lines 278..283
seller/js/controllers/selectproducts.js on lines 284..290
seller/js/controllers/selectproducts.js on lines 291..297
seller/js/controllers/selectproducts.js on lines 298..304

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 73.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 16 locations. Consider refactoring.
Open

    $scope.resetLooks = function() {
        for (i = 0; i < $scope.looksLength; i++)
            $scope.selectedLooks[i] = false;         
     
         $scope.updateUrlChanges();
Severity: Major
Found in admin/js/controllers/new_sellerProducts.js and 15 other locations - About 1 hr to fix
admin/js/controllers/edited_sellerProducts.js on lines 276..281
admin/js/controllers/edited_sellerProducts.js on lines 282..288
admin/js/controllers/edited_sellerProducts.js on lines 289..295
admin/js/controllers/edited_sellerProducts.js on lines 296..302
admin/js/controllers/new_sellerProducts.js on lines 272..277
admin/js/controllers/new_sellerProducts.js on lines 278..284
admin/js/controllers/new_sellerProducts.js on lines 285..291
seller/js/controllers/selected_products.js on lines 251..256
seller/js/controllers/selected_products.js on lines 257..263
seller/js/controllers/selected_products.js on lines 264..270
seller/js/controllers/selected_products.js on lines 271..277
seller/js/controllers/selectproducts.js on lines 278..283
seller/js/controllers/selectproducts.js on lines 284..290
seller/js/controllers/selectproducts.js on lines 291..297
seller/js/controllers/selectproducts.js on lines 298..304

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 73.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 16 locations. Consider refactoring.
Open

    $scope.resetMaterials = function() {
        for (i = 0; i < $scope.materialsLength; i++)
            $scope.selectedMaterials[i] = false;         
     
         $scope.updateUrlChanges();
Severity: Major
Found in admin/js/controllers/new_sellerProducts.js and 15 other locations - About 1 hr to fix
admin/js/controllers/edited_sellerProducts.js on lines 276..281
admin/js/controllers/edited_sellerProducts.js on lines 282..288
admin/js/controllers/edited_sellerProducts.js on lines 289..295
admin/js/controllers/edited_sellerProducts.js on lines 296..302
admin/js/controllers/new_sellerProducts.js on lines 272..277
admin/js/controllers/new_sellerProducts.js on lines 278..284
admin/js/controllers/new_sellerProducts.js on lines 292..298
seller/js/controllers/selected_products.js on lines 251..256
seller/js/controllers/selected_products.js on lines 257..263
seller/js/controllers/selected_products.js on lines 264..270
seller/js/controllers/selected_products.js on lines 271..277
seller/js/controllers/selectproducts.js on lines 278..283
seller/js/controllers/selectproducts.js on lines 284..290
seller/js/controllers/selectproducts.js on lines 291..297
seller/js/controllers/selectproducts.js on lines 298..304

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 73.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 16 locations. Consider refactoring.
Open

    $scope.resetBrands = function() {
      for (i = 0; i < $scope.totalBrands; i++)
          $scope.selectedBrands[i] = false;         
         $scope.updateUrlChanges();
        $scope.requestToSearchAPI();
Severity: Major
Found in admin/js/controllers/new_sellerProducts.js and 15 other locations - About 1 hr to fix
admin/js/controllers/edited_sellerProducts.js on lines 276..281
admin/js/controllers/edited_sellerProducts.js on lines 282..288
admin/js/controllers/edited_sellerProducts.js on lines 289..295
admin/js/controllers/edited_sellerProducts.js on lines 296..302
admin/js/controllers/new_sellerProducts.js on lines 278..284
admin/js/controllers/new_sellerProducts.js on lines 285..291
admin/js/controllers/new_sellerProducts.js on lines 292..298
seller/js/controllers/selected_products.js on lines 251..256
seller/js/controllers/selected_products.js on lines 257..263
seller/js/controllers/selected_products.js on lines 264..270
seller/js/controllers/selected_products.js on lines 271..277
seller/js/controllers/selectproducts.js on lines 278..283
seller/js/controllers/selectproducts.js on lines 284..290
seller/js/controllers/selectproducts.js on lines 291..297
seller/js/controllers/selectproducts.js on lines 298..304

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 73.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 4 locations. Consider refactoring.
Open

    $scope.lookHTML =  (typeof $location.search().looks == 'undefined') ? '' : '| Looks = '+ $location.search().looks   ;
Severity: Major
Found in admin/js/controllers/new_sellerProducts.js and 3 other locations - About 50 mins to fix
admin/js/controllers/edited_sellerProducts.js on lines 197..197
seller/js/controllers/selected_products.js on lines 180..180
seller/js/controllers/selectproducts.js on lines 205..205

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 51.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

There are no issues that match your filters.

Category
Status