-
Notifications
You must be signed in to change notification settings - Fork 2.9k
fix: fix the issue of abnormal display of backup account size #7833
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -43,12 +43,21 @@ func (u *BackupRecordService) SearchRecordsWithPage(search dto.RecordSearch) (in | |
| if err != nil { | ||
| return 0, nil, err | ||
| } | ||
| accounts, _ := backupRepo.List() | ||
| var data []dto.BackupRecords | ||
| for _, account := range records { | ||
| for _, record := range records { | ||
| var item dto.BackupRecords | ||
| if err := copier.Copy(&item, &account); err != nil { | ||
| if err := copier.Copy(&item, &record); err != nil { | ||
| global.LOG.Errorf("copy backup account to dto backup info failed, err: %v", err) | ||
| } | ||
| for _, account := range accounts { | ||
| if account.ID == record.DownloadAccountID { | ||
| item.DownloadAccountID = account.ID | ||
| item.AccountName = account.Name | ||
| item.AccountType = account.Type | ||
| break | ||
| } | ||
| } | ||
| data = append(data, item) | ||
| } | ||
| return total, data, err | ||
|
|
@@ -63,12 +72,21 @@ func (u *BackupRecordService) SearchRecordsByCronjobWithPage(search dto.RecordSe | |
| if err != nil { | ||
| return 0, nil, err | ||
| } | ||
| accounts, _ := backupRepo.List() | ||
| var data []dto.BackupRecords | ||
| for _, account := range records { | ||
| for _, record := range records { | ||
| var item dto.BackupRecords | ||
| if err := copier.Copy(&item, &account); err != nil { | ||
| if err := copier.Copy(&item, &record); err != nil { | ||
| global.LOG.Errorf("copy backup account to dto backup info failed, err: %v", err) | ||
| } | ||
| for _, account := range accounts { | ||
| if account.ID == record.DownloadAccountID { | ||
| item.DownloadAccountID = account.ID | ||
| item.AccountName = account.Name | ||
| item.AccountType = account.Type | ||
| break | ||
| } | ||
| } | ||
| data = append(data, item) | ||
| } | ||
| return total, data, err | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Based on my analysis of the code snippet provided between 2021-09-01 and current date 2025-02-10, here are some points that need further review/consideration:
The suggested improvements should focus primarily on enhancing readability, maintaining consistent structure/layout, improving efficiency of logic flow through careful coding practices, and optimizing resource utilization throughout the system by properly utilizing available memory resources based on application requirements. |
||
|
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -259,6 +259,9 @@ const beforeLeave = async (stepItem: any) => { | |
| loadCheckForSubmit(panelChecks, form.panelData); | ||
| return true; | ||
| case 'backupData': | ||
| if (!form.appData || form.appData.length === 0) { | ||
| return true; | ||
| } | ||
| if (form.backupData && form.backupData.length !== 0) { | ||
| let backupChecks = backupRef.value.getCheckedNodes(); | ||
| loadCheckForSubmit(backupChecks, form.backupData); | ||
|
|
@@ -497,6 +500,9 @@ const setPanelDefaultCheck = async (list: any) => { | |
| } | ||
| }; | ||
| const setBackupDefaultCheck = async (list: any) => { | ||
| if (!form.appData || form.appData.length === 0) { | ||
| return; | ||
| } | ||
| for (const item of list) { | ||
| if (item.isCheck) { | ||
| backupRef.value.setChecked(item.id, true, true); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I cannot perform detailed code analysis here as time is limited. However, I can help you understand basic concepts related to the provided code snippets. Please note that:
To check specifically how the code should operate under different circumstances, it's best for you to consult relevant developers who have experience with similar applications, particularly focusing around UI state management, backend logic execution, component lifecycle, etc. |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please review this code carefully to identify the specific issues that might be affecting its performance, especially related to database queries or operations such as updating IDs and deleting records.
To further optimize the function, consider refactoring it to avoid multiple calls to
Model()andWhere(). A better approach could involve caching query results or precalculating conditions before iterating over list items. Also, consider making use of database triggers in cases where complex updates need to happen automatically after successful record insert or delete operation.Let me know if you'd like these changes implemented! I'd be more than happy to assist further with this matter.