Skip to content

Commit

Permalink
feat: cleaning console.logs
Browse files Browse the repository at this point in the history
  • Loading branch information
sercancicek committed Mar 18, 2024
1 parent b3873e8 commit 6c5cd55
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 32 deletions.
2 changes: 0 additions & 2 deletions src/app/components/search/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,11 @@ angular
}
});
});
console.log("search.js: finalResults: ", finalResults);
return finalResults;
}

var watchExpressions = ['query', 'checkboxStatus.show_names', 'checkboxStatus.show_descriptions', 'checkboxStatus.show_columns', 'checkboxStatus.show_column_descriptions', 'checkboxStatus.show_code', 'checkboxStatus.show_tags'];
scope.$watchGroup(watchExpressions, function() {
console.log("filterResultsfilterResultsfilterResultsfilterResults");
scope.filteredResults = filterResults(scope.results, scope.checkboxStatus);
});

Expand Down
35 changes: 5 additions & 30 deletions src/app/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ angular
});

$scope.$watch('search.query', function(q) {
console.log("assignSearchRelevanceassignSearchRelevanceassignSearchRelevance");
$scope.search.results = assignSearchRelevance(projectService.search(q));
});

Expand All @@ -160,29 +159,10 @@ angular
"raw_code": 2,
"columns": 1
};
let criteriaCountDict = {
"name": 0,
"tags": 0,
"description": 0,
// "raw_code": 0,
// "columns": 0
}

_.each(results, function(result){
result.overallWeight = 0;
result.criteraCounter = {
"name": 0,
"tags": 0,
"description": 0,
"raw_code": 0,
"columns": 0
};
result.criteraWeight = {
"name": 0,
"tags": 0,
"description": 0,
"raw_code": 0,
"columns": 0
};
result.overallNameWeight = 0;
_.each(Object.keys(criteriaArr), function(criteria){
if(result.model[criteria] != undefined){
let count = 0;
Expand Down Expand Up @@ -221,7 +201,6 @@ angular
}
else if(criteria === "name"){
if (body === query) {
console.log("index.js: body: ", body, " query: ", query);
count += 10;
}
else if (body.toLowerCase().startsWith(query)) {
Expand All @@ -233,6 +212,7 @@ angular
else if (body.toLowerCase().includes(query)) {
count++;
}
result.overallNameWeight += (count * criteriaArr[criteria]);
}
else{
body = body.toLowerCase();
Expand All @@ -244,23 +224,18 @@ angular
}
}
}
result.criteraCounter[criteria] += count;
result.criteraWeight[criteria] += (count * criteriaArr[criteria]);
result.overallWeight += (count * criteriaArr[criteria]);
}
result.counter = criteriaCountDict;
});
});
console.log("index.js: before sort results: ", results);

results.sort(function(a, b) {
if (b.criteraWeight["name"] === a.criteraWeight["name"]) {
if (b.overallNameWeight === a.overallNameWeight) {
return b.overallWeight - a.overallWeight;
}
return b.criteraWeight["name"] - a.criteraWeight["name"] // Sorting by 'name' property in ascending order.
return b.overallNameWeight - a.overallNameWeight
});

console.log("index.js: results: ", results);
return results;
}

Expand Down

0 comments on commit 6c5cd55

Please sign in to comment.