Skip to content

WEB-879 Handle API response where report category returns '(NULL)' string#3422

Open
Omar-Nabil2 wants to merge 1 commit intoopenMF:devfrom
Omar-Nabil2:fix/handle-null-report-category-display
Open

WEB-879 Handle API response where report category returns '(NULL)' string#3422
Omar-Nabil2 wants to merge 1 commit intoopenMF:devfrom
Omar-Nabil2:fix/handle-null-report-category-display

Conversation

@Omar-Nabil2
Copy link
Contributor

@Omar-Nabil2 Omar-Nabil2 commented Mar 20, 2026

Description

Handle API response where report category returns '(NULL)' string, displaying empty cell instead of null text in table.

Screenshots, if any

before
image

after
image

Checklist

Please make sure these boxes are checked before submitting your pull request - thanks!

  • If you have multiple commits please combine them into one commit by squashing them.

  • Read and understood the contribution guidelines at web-app/.github/CONTRIBUTING.md.

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Fixed handling of missing report categories in the manage reports view. Improved data normalization to properly display report information when categories or descriptions are unavailable.

Copilot AI review requested due to automatic review settings March 20, 2026 17:21
@coderabbitai
Copy link

coderabbitai bot commented Mar 20, 2026

Warning

Rate limit exceeded

@Omar-Nabil2 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 18 minutes and 49 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3e36a5a2-f7a2-408f-8dd9-2e13663e4cbb

📥 Commits

Reviewing files that changed from the base of the PR and between 4f95191 and ab6c4f4.

📒 Files selected for processing (2)
  • src/app/system/manage-reports/manage-reports.component.html
  • src/app/system/manage-reports/manage-reports.component.ts

Note

.coderabbit.yaml has unrecognized properties

CodeRabbit is using all valid settings from your configuration. Unrecognized properties (listed below) have been ignored and may indicate typos or deprecated fields that can be removed.

⚠️ Parsing warnings (1)
Validation error: Unrecognized key(s) in object: 'pre_merge_checks'
⚙️ Configuration instructions
  • Please see the configuration documentation for more information.
  • You can also validate your configuration using the online YAML validator.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Walkthrough

The manage-reports component is updated to properly handle null and falsy values in report data. The TypeScript service transforms string literals '(NULL)' into actual null values, while the template conditionally applies translation pipes only when data is present.

Changes

Cohort / File(s) Summary
Data Handling & Display
src/app/system/manage-reports/manage-reports.component.ts, src/app/system/manage-reports/manage-reports.component.html
TypeScript now transforms '(NULL)' strings to null for reportCategory and description fields in setReports(). Template updated to conditionally apply translateKey pipe only when reportCategory exists, preventing translation attempts on null/undefined values.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested reviewers

  • IOhacker
🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main change: handling API responses where report category returns '(NULL)' string instead of null.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the System → Manage Reports table rendering to avoid displaying the literal '(NULL)' string returned by the reports API, showing an empty cell instead.

Changes:

  • Sanitizes reports table data by converting '(NULL)' values to null before creating the MatTableDataSource.
  • Updates the reportCategory cell template to render blank output when the category is missing.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/app/system/manage-reports/manage-reports.component.ts Transforms incoming reports data (replacing '(NULL)') before binding to the table; adds debug logging/imports.
src/app/system/manage-reports/manage-reports.component.html Renders reportCategory as empty when null/absent instead of translating/displaying null-like text.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

import { FaIconComponent } from '@fortawesome/angular-fontawesome';
import { MatTooltip } from '@angular/material/tooltip';
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
import { log } from 'console';
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

import { log } from 'console'; pulls in Node's console module (not browser/Angular) and the imported symbol is unused. This will likely break the web build and/or fail linting—please remove this import (and avoid Node built-ins in Angular code).

Suggested change
import { log } from 'console';

Copilot uses AI. Check for mistakes.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/app/system/manage-reports/manage-reports.component.ts`:
- Line 108: Remove the debug console.log in ManageReportsComponent (the line
logging 'Reports Data:' in manage-reports.component.ts); locate the statement
inside the component method that sets or handles this.reportsData (e.g.,
ngOnInit or the method that loads reports) and delete that console.log call so
no debug logging remains in production.
- Line 38: Remove the invalid Node.js import statement "import { log } from
'console'" from manage-reports.component.ts and any references to the imported
symbol (if present); the browser environment should use the global console API
(e.g., console.log) already used elsewhere (e.g., in the code that calls
console.log), so simply delete the import line and ensure there are no usages of
the identifier log remaining.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 68461667-99a3-42cd-8328-d1621efe9142

📥 Commits

Reviewing files that changed from the base of the PR and between cbc7cd5 and 4f95191.

📒 Files selected for processing (2)
  • src/app/system/manage-reports/manage-reports.component.html
  • src/app/system/manage-reports/manage-reports.component.ts

import { FaIconComponent } from '@fortawesome/angular-fontawesome';
import { MatTooltip } from '@angular/material/tooltip';
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
import { log } from 'console';
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Remove invalid Node.js import.

import { log } from 'console' imports from the Node.js console module, which is not available in browser environments. This import is also unused since line 108 uses console.log directly (the global browser API). This will cause a build/runtime error.

🐛 Proposed fix
-import { log } from 'console';
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { log } from 'console';
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/app/system/manage-reports/manage-reports.component.ts` at line 38, Remove
the invalid Node.js import statement "import { log } from 'console'" from
manage-reports.component.ts and any references to the imported symbol (if
present); the browser environment should use the global console API (e.g.,
console.log) already used elsewhere (e.g., in the code that calls console.log),
so simply delete the import line and ensure there are no usages of the
identifier log remaining.

constructor() {
this.route.data.subscribe((data: { reports: any }) => {
this.reportsData = data.reports;
console.log('Reports Data:', this.reportsData);
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Remove debug logging before merging.

This console.log statement appears to be debug code that should not be included in production. Remove it before merging.

🐛 Proposed fix
     this.route.data.subscribe((data: { reports: any }) => {
       this.reportsData = data.reports;
-      console.log('Reports Data:', this.reportsData);
     });
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
console.log('Reports Data:', this.reportsData);
this.route.data.subscribe((data: { reports: any }) => {
this.reportsData = data.reports;
});
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/app/system/manage-reports/manage-reports.component.ts` at line 108,
Remove the debug console.log in ManageReportsComponent (the line logging
'Reports Data:' in manage-reports.component.ts); locate the statement inside the
component method that sets or handles this.reportsData (e.g., ngOnInit or the
method that loads reports) and delete that console.log call so no debug logging
remains in production.

@Omar-Nabil2 Omar-Nabil2 force-pushed the fix/handle-null-report-category-display branch from 4f95191 to ab6c4f4 Compare March 20, 2026 17:34
Copy link
Collaborator

@alberto-art3ch alberto-art3ch left a comment

Choose a reason for hiding this comment

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

Please remove los console.lo y el import

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Omar-Nabil2
Copy link
Contributor Author

Omar-Nabil2 commented Mar 21, 2026

@IOhacker I have removed it. Could you check the changes again ?

Copy link
Contributor

@IOhacker IOhacker left a comment

Choose a reason for hiding this comment

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

LGTM

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.

4 participants