Skip to content

Commit

Permalink
Fixed issues in the code that were causing some of the CI tests to fail
Browse files Browse the repository at this point in the history
  • Loading branch information
cccs-Dustin committed Feb 25, 2022
1 parent db84e25 commit 3fcd052
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions superset-frontend/src/SqlLab/components/TabbedSqlEditors/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -260,22 +260,22 @@ class TabbedSqlEditors extends React.PureComponent {
let newTitle;

if (this.props.queryEditors.length > 0) {
const untitled_query_numbers = this.props.queryEditors
const untitledQueryNumbers = this.props.queryEditors
.filter(x => x.title.includes('Untitled Query '))
.map(x => x.title.replace('Untitled Query ', ''))
.filter(x => !isNaN(x));
if (untitled_query_numbers.length > 0) {
//When there are query tabs open, and at least one is called "Untitled Query #"
//Where # is a valid number
const largest_Number = Math.max.apply(null, untitled_query_numbers);
newTitle = t('Untitled Query %s', largest_Number + 1);
.filter(x => !Number.isNaN(Number(x)));
if (untitledQueryNumbers.length > 0) {
// When there are query tabs open, and at least one is called "Untitled Query #"
// Where # is a valid number
const largestNumber = Math.max.apply(null, untitledQueryNumbers);
newTitle = t('Untitled Query %s', largestNumber + 1);
} else {
//When there are query tabs open but none of them are called "Untitled Query #"
//Where # is a valid number
// When there are query tabs open but none of them are called "Untitled Query #"
// Where # is a valid number
newTitle = 'Untitled Query 1';
}
} else {
//When there are no query tabs currently open
// When there are no query tabs currently open
newTitle = 'Untitled Query 1';
}

Expand Down

0 comments on commit 3fcd052

Please sign in to comment.