Skip to content
Merged
Show file tree
Hide file tree
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
11 changes: 6 additions & 5 deletions web/core/local-db/storage.sqlite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ export class Storage {
}
}
const groupCount = group_by ? Object.keys(issueResults).length : undefined;
const subGroupCount = sub_group_by ? Object.keys(issueResults[Object.keys(issueResults)[0]]).length : undefined;
// const subGroupCount = sub_group_by ? Object.keys(issueResults[Object.keys(issueResults)[0]]).length : undefined;
const groupingEnd = performance.now();

const times = {
Expand All @@ -348,8 +348,9 @@ export class Storage {
Grouping: groupingEnd - grouping,
};
log(issueResults);
console.table(times);

if ((window as any).DEBUG) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Avoid using 'any' type when accessing window.DEBUG

Casting window as any bypasses TypeScript's type safety. Instead, extend the global Window interface to include the DEBUG property for better type safety.

Apply this diff to improve type safety:

+declare global {
+  interface Window {
+    DEBUG: boolean;
+  }
+}

-        if ((window as any).DEBUG) {
+        if (window.DEBUG) {
           console.table(times);
         }

Committable suggestion was skipped due to low confidence.

console.table(times);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Remove unnecessary console logs

The console.table(times); statement may introduce unnecessary console output in production. Since the PR aims to fix unnecessary console logs, consider removing it or ensuring it runs only in development environments.

}
const total_pages = Math.ceil(total_count / Number(pageSize));
const next_page_results = total_pages > parseInt(page) + 1;

Expand All @@ -372,7 +373,7 @@ export class Storage {
queries: queries,
local: true,
groupCount,
subGroupCount,
// subGroupCount,
});
return out;
};
Expand Down Expand Up @@ -449,5 +450,5 @@ export const formatLocalIssue = (issue: any) => {
ARRAY_FIELDS.forEach((field: string) => {
currIssue[field] = currIssue[field] ? JSON.parse(currIssue[field]) : [];
});
return currIssue as TIssue;
return currIssue as TIssue & { group_id?: string; total_issues: number; sub_group_id?: string };
};
4 changes: 2 additions & 2 deletions web/core/local-db/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const wrapDateTime = (field: string) => {
return field;
};

export const getGroupedIssueResults = (issueResults: (TIssue & { group_id: string; total_issues: number })[]): any => {
export const getGroupedIssueResults = (issueResults: (TIssue & { group_id?: string; total_issues: number })[]): any => {
const groupedResults: {
[key: string]: {
results: TIssue[];
Expand All @@ -95,7 +95,7 @@ export const getGroupedIssueResults = (issueResults: (TIssue & { group_id: strin
};

export const getSubGroupedIssueResults = (
issueResults: (TIssue & { group_id: string; total_issues: number; sub_group_id: string })[]
issueResults: (TIssue & { group_id?: string; total_issues: number; sub_group_id?: string })[]
): any => {
const subGroupedResults: {
[key: string]: {
Expand Down