Fixed #333 sort frequently used tables based on usage. (#341)

This commit is contained in:
Sachin Chaurasiya 2021-08-31 11:27:19 +05:30 committed by GitHub
parent 32b8bea8c2
commit 48d6776240
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -28,7 +28,8 @@ type Props = {
const viewCap = 3; const viewCap = 3;
const getUniqueTablesWithCount = (tableFQNs: Props['tableList']) => { const getUniqueTablesWithCount = (tableFQNs: Props['tableList']) => {
return tableFQNs.reduce((resList, curr) => { return tableFQNs
.reduce((resList, curr) => {
let duplicates = false; let duplicates = false;
for (const table of resList) { for (const table of resList) {
if (table.fqn === curr.fqn) { if (table.fqn === curr.fqn) {
@ -40,7 +41,8 @@ const getUniqueTablesWithCount = (tableFQNs: Props['tableList']) => {
} }
return duplicates ? resList : [...resList, curr]; return duplicates ? resList : [...resList, curr];
}, [] as Props['tableList']); }, [] as Props['tableList'])
.sort((a, b) => (a.joinCount < b.joinCount ? 1 : -1));
}; };
const FrequentlyJoinedTables: FunctionComponent<Props> = ({ const FrequentlyJoinedTables: FunctionComponent<Props> = ({