Skip to content

Conversation

nitrosx
Copy link
Member

@nitrosx nitrosx commented Aug 20, 2025

Description

This PR removes the custom function to extract the run number from the scientific metadata, but uses the high level field.

Motivation

We need to show run number high level field by default. A soon to be created PR, will allow to include scientific metadata in the datasets list, so a different run number from scientific metadata will be addressed by the new PR.

Changes:

Please provide a list of the changes implemented by this PR

  • datasets table

Tests included

  • Included for each change/fix?
  • Passing? (Merge will not be approved unless this is checked)

Documentation

  • swagger documentation updated [required]
  • official documentation updated [nice-to-have]

official documentation info

If you have updated the official documentation, please provide PR # and URL of the pages where the updates are included

Backend version

  • Does it require a specific version of the backend
  • which version of the backend is required:

Summary by Sourcery

Fix run number display in the dataset list by removing the custom scientific metadata fallback and using the high-level runNumber field, add localization of table headers, and standardize translation namespaces across dataset components.

Bug Fixes:

  • Use the high-level runNumber field for the dataset list instead of the scientificMetadata fallback

Enhancements:

  • Inject TranslateService to translate dataset table column headers using the "dataset" namespace
  • Unify translation context to "dataset" in both dataset-detail components

Chores:

  • Add console.log statements in DynamicMatTableComponent for debugging

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • There are leftover console.log debug statements in DynamicMatTableComponent—please remove them before merging.
  • The old runNumber customRender block is just commented out; consider deleting it or refactoring it into a clear fallback path to keep the codebase clean.
  • Subscribing directly to forkJoin for header translations without teardown can lead to memory leaks—consider using the async pipe or unsubscribing in ngOnDestroy.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- There are leftover console.log debug statements in DynamicMatTableComponent—please remove them before merging.
- The old runNumber customRender block is just commented out; consider deleting it or refactoring it into a clear fallback path to keep the codebase clean.
- Subscribing directly to forkJoin for header translations without teardown can lead to memory leaks—consider using the async pipe or unsubscribing in ngOnDestroy.

## Individual Comments

### Comment 1
<location> `src/app/datasets/dataset-table/dataset-table.component.ts:407` </location>
<code_context>
-          convertedColumn.toExport = (row) =>
-            lodashGet(row, "scientificMetadata.runNumber.value");
-        }
+        // if (column.name === "runNumber" && column.type !== "custom") {
+        //   // NOTE: This is for the saved columns in the database or the old config.
+        //   convertedColumn.customRender = (c, row) =>
+        //     lodashGet(row, "scientificMetadata.runNumber.value");
+        //   convertedColumn.toExport = (row) =>
+        //     lodashGet(row, "scientificMetadata.runNumber.value");
+        // }
</code_context>

<issue_to_address>
Commented-out code for runNumber handling may cause confusion.

Remove deprecated code if no longer needed, or add a comment specifying when and why it should be re-enabled if it's only temporarily disabled.
</issue_to_address>

### Comment 2
<location> `src/app/shared/modules/dynamic-material-table/table/dynamic-mat-table.component.ts:515` </location>
<code_context>
   }

   columnName(row: any, column: TableField<any>) {
+    console.log("------");
+    console.log(row);
+    console.log(column);
     if (column.customRender) {
+      console.log("Custom");
+      console.log(column.customRender(column, row));
       return column.customRender(column, row);
     }
-
+    console.log("standard");
+    console.log(row[column.name]);
     return row[column.name];
   }
</code_context>

<issue_to_address>
Debugging console.log statements should be removed before merging.

Please remove these console.log statements or use a proper logging mechanism if necessary.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +407 to +411
// if (column.name === "runNumber" && column.type !== "custom") {
// // NOTE: This is for the saved columns in the database or the old config.
// convertedColumn.customRender = (c, row) =>
// lodashGet(row, "scientificMetadata.runNumber.value");
// convertedColumn.toExport = (row) =>
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: Commented-out code for runNumber handling may cause confusion.

Remove deprecated code if no longer needed, or add a comment specifying when and why it should be re-enabled if it's only temporarily disabled.

Comment on lines +515 to +524
console.log("------");
console.log(row);
console.log(column);
if (column.customRender) {
console.log("Custom");
console.log(column.customRender(column, row));
return column.customRender(column, row);
}

console.log("standard");
console.log(row[column.name]);
Copy link
Contributor

Choose a reason for hiding this comment

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

issue: Debugging console.log statements should be removed before merging.

Please remove these console.log statements or use a proper logging mechanism if necessary.

@nitrosx nitrosx changed the title Fixing run number in dataset list fix: fixing run number in dataset list Aug 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant