Skip to content

Commit

Permalink
feat: Remove un needed code for remove hidden selection after engine
Browse files Browse the repository at this point in the history
  • Loading branch information
AmrDeveloper committed Jul 16, 2024
1 parent 5eb3082 commit 691d14c
Showing 1 changed file with 0 additions and 38 deletions.
38 changes: 0 additions & 38 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,49 +206,11 @@ fn execute_gitql_query(
);
}
OutputFormat::JSON => {
let mut indexes = vec![];
for (index, title) in groups.titles.iter().enumerate() {
if hidden_selection.contains(title) {
indexes.insert(0, index);
}
}

if groups.len() > 1 {
groups.flat()
}

for index in indexes {
groups.titles.remove(index);

for row in &mut groups.groups[0].rows {
row.values.remove(index);
}
}

if let Ok(json) = groups.as_json() {
println!("{}", json);
}
}
OutputFormat::CSV => {
let mut indexes = vec![];
for (index, title) in groups.titles.iter().enumerate() {
if hidden_selection.contains(title) {
indexes.insert(0, index);
}
}

if groups.len() > 1 {
groups.flat()
}

for index in indexes {
groups.titles.remove(index);

for row in &mut groups.groups[0].rows {
row.values.remove(index);
}
}

if let Ok(csv) = groups.as_csv() {
println!("{}", csv);
}
Expand Down

0 comments on commit 691d14c

Please sign in to comment.