Skip to content

Commit 7f7919b

Browse files
committed
Refactored by Copilot's suggestions
1 parent c441319 commit 7f7919b

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/app/item-page/simple/field-components/file-section/total-downloads.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ export class TotalDownloadsComponent implements OnInit {
5151
* and if enabled, fetches the total download statistics for the item specified by itemUuid.
5252
* The component will:
5353
* 1. Check the 'item.view.total.downloads.enabled' configuration property
54-
* 2. If enabled (or config not found - defaults to true), call the UsageReportDataService
54+
* 2. If enabled (configuration value is 'true'), call the UsageReportDataService,
55+
* if config is not found, defaults to false
5556
* 3. Aggregate all download counts (views) from all bitstreams in the response
5657
* 4. Set the totalDownloads property with the sum
5758
* 5. Handle errors gracefully by setting totalDownloads to 0 and logging the error
@@ -78,7 +79,7 @@ export class TotalDownloadsComponent implements OnInit {
7879
this.totalDownloadsEnabled.next(itemViewTotalDownloadsEnabled === 'true');
7980

8081
// Only fetch download statistics if the feature is enabled
81-
if (this.totalDownloadsEnabled) {
82+
if (this.totalDownloadsEnabled.value) {
8283
this.fetchDownloadStatistics();
8384
} else {
8485
this.totalDownloads = 0; // Ensure it's 0 when disabled

0 commit comments

Comments
 (0)