Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add filter by number of assignees #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions scripts/cover.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ function main(data_list) {
var all_prog_langs = [];
var all_types_of_issues = [];
var all_repo_names = [];
var all_assignee_counts = [];

for (let i = 0; i < data_list.length; i++) {
if (data_list[i].Issue.issue_url === "") {
Expand All @@ -75,6 +76,9 @@ function main(data_list) {
issue_labels.forEach(i => {
all_types_of_issues.push((i.toLowerCase()));
});

let issue_assignee_count = issue.getNumAssignees();
all_assignee_counts.push(issue_assignee_count);

let repo = issue.getIssueRepoName();
all_repo_names.push(repo);
Expand All @@ -93,9 +97,13 @@ function main(data_list) {
var sorted_repo_name_counter = returnSortedCounterForCheckBox(all_repo_names);
createCheckBoxFromCounter(sorted_repo_name_counter, "Repository", "repo");

var sorted_assignee_counter = returnSortedCounterForCheckBox(all_assignee_counts);
createCheckBoxFromCounter(sorted_assignee_counter, "Assignees", "assignee");

let checked_proglangs = [];
let checked_labels = [];
let checked_repo_names = [];
let checked_assignees = [];

$("select").change(function() {
let dropdown_id = $(this).attr("id");
Expand Down Expand Up @@ -123,37 +131,44 @@ function main(data_list) {
checked_proglangs = checked_items.slice();
} else if (dropdown_id === "dropdownlabel") {
checked_labels = checked_items.slice();
} else {
} else if (dropdown_id === 'dropdownrepo') {
checked_repo_names = checked_items.slice();
} else if (dropdown_id === 'dropdownassignee') {
checked_assignees = checked_items.slice();
}

// Do the actual filtering
if (_.isEmpty(checked_proglangs) &&
_.isEmpty(checked_labels) &&
_.isEmpty(checked_repo_names)) {
_.isEmpty(checked_repo_names) &&
_.isEmpty(checked_assignees)) {
renderFilteredList(sorted_issues_html_list, entries_per_page);
} else {
let filtered_list = [];
checked_proglangs = _.map(checked_proglangs, i => i.toLowerCase());
checked_labels = _.map(checked_labels, i => i.toLowerCase());
checked_assignees = _.map(checked_assignees, i => Number(i));

for (let j = 0; j < issues_list.length; j++) {
let issue_item = issues_list[j];
let repo_langs = issue_item.getRepoProgLangs();
let issues_labels = issue_item.getIssueLabels();
let issue_repo = issue_item.getIssueRepoName();
let issue_assignee_count = issue_item.getNumAssignees();

let lowered_issue_labels = _.map(issues_labels, i => i.toLowerCase());
let lowered_prog_langs = _.map(repo_langs, i => i.toLowerCase());

let intersection_prog_langs = _.intersection(checked_proglangs, lowered_prog_langs);
let intersection_labels = _.intersection(checked_labels, lowered_issue_labels);
let intersection_repos = _.intersection(checked_repo_names, [issue_repo]);
let intersection_assignee = _.intersection(checked_assignees, [issue_assignee_count]);

let num_intersections = _.concat(
intersection_prog_langs,
intersection_labels,
intersection_repos
intersection_repos,
intersection_assignee
).length;

if (num_intersections > 0) {
Expand Down