Skip to content

Conversation

@Rakshithasai123
Copy link
Contributor

@Rakshithasai123 Rakshithasai123 commented Nov 18, 2025

RCF-1268

Summary by CodeRabbit

  • Bug Fixes
    • Biometric validation now enforces quality thresholds, rejecting captures below configured standards to ensure higher data quality.

✏️ Tip: You can customize this high-level summary in your review settings.

…t button should not enabled

Signed-off-by: Rakshithasai123 <rakshithasai2002@gmail.com>

# Conflicts:
#	lib/ui/settings/widgets/global_config_settings_tab.dart
…me, continue button is not enable in biometric page

Signed-off-by: Rakshithasai123 <rakshithasai2002@gmail.com>
Signed-off-by: Rakshithasai123 <rakshithasai2002@gmail.com>
Signed-off-by: Rakshithasai123 <rakshithasai2002@gmail.com>
@coderabbitai
Copy link

coderabbitai bot commented Dec 18, 2025

Walkthrough

Two files modified: biometric validation logic in generic_process.dart now includes quality percentage checks on recent BiometricAttributeData captures at multiple validation points; separate formatting adjustments added to global_config_settings_tab.dart.

Changes

Cohort / File(s) Summary
Biometric validation quality gates
lib/ui/process_ui/generic_process.dart
Added quality percentage validation checks in customValidation for biometric fields. When isValidBiometricCapture is true, inspects the most recent BiometricAttributeData entry in fieldInputValue. If qualityPercentage falls below parsed thresholdPercentage, marks validation as invalid and breaks. Logic applied at two separate validation checkpoints.
Formatting adjustments
lib/ui/settings/widgets/global_config_settings_tab.dart
Added empty lines within class fields. Whitespace-only changes with no impact to logic or control flow.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review biometric quality check logic at both validation points to ensure threshold comparison and fieldInputValue access are correct
  • Verify that breaking on invalid quality captures doesn't bypass other necessary validation steps
  • Confirm BiometricAttributeData structure compatibility and qualityPercentage data type assumptions

Poem

🐰 A biometric bouncer now guards the gate,
Quality checks ensure captures are great,
No fuzzy faces shall pass through today,
With threshold precision leading the way! ✨

Pre-merge checks and finishing touches

✅ 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 describes a specific bug fix: enabling the continue button when biometric threshold and score values match, which aligns with the code changes implementing a quality gate for biometric validation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

Signed-off-by: Rakshithasai123 <rakshithasai2002@gmail.com>
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

📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 81dd792 and 77e7338.

📒 Files selected for processing (2)
  • lib/ui/process_ui/generic_process.dart (2 hunks)
  • lib/ui/settings/widgets/global_config_settings_tab.dart (2 hunks)
🔇 Additional comments (1)
lib/ui/settings/widgets/global_config_settings_tab.dart (1)

31-31: Formatting changes only—no functional impact.

These whitespace additions don't affect behavior or maintainability.

Also applies to: 177-177, 180-180

Comment on lines +526 to 534
List<BiometricAttributeData> list = globalProvider.fieldInputValue[field.id!] ?? [];
if (list.isNotEmpty) {
BiometricAttributeData lastCapture = list.last;
if (lastCapture.qualityPercentage < int.parse(lastCapture.thresholdPercentage)) {
isValid = false;
break;
}
}
}
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

Add error handling for threshold parsing.

int.parse() will throw a FormatException if thresholdPercentage is not a valid integer string or if it's null. This can crash the validation flow.

🔎 Apply this diff to add safe parsing with error handling:
 if (globalProvider.isValidBiometricCapture) {
   List<BiometricAttributeData> list = globalProvider.fieldInputValue[field.id!] ?? [];
   if (list.isNotEmpty) {
     BiometricAttributeData lastCapture = list.last;
-    if (lastCapture.qualityPercentage < int.parse(lastCapture.thresholdPercentage)) {
+    int? threshold = int.tryParse(lastCapture.thresholdPercentage);
+    if (threshold != null && lastCapture.qualityPercentage < threshold) {
       isValid = false;
       break;
     }
   }
 }
📝 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
List<BiometricAttributeData> list = globalProvider.fieldInputValue[field.id!] ?? [];
if (list.isNotEmpty) {
BiometricAttributeData lastCapture = list.last;
if (lastCapture.qualityPercentage < int.parse(lastCapture.thresholdPercentage)) {
isValid = false;
break;
}
}
}
List<BiometricAttributeData> list = globalProvider.fieldInputValue[field.id!] ?? [];
if (list.isNotEmpty) {
BiometricAttributeData lastCapture = list.last;
int? threshold = int.tryParse(lastCapture.thresholdPercentage);
if (threshold != null && lastCapture.qualityPercentage < threshold) {
isValid = false;
break;
}
}
}
🤖 Prompt for AI Agents
In lib/ui/process_ui/generic_process.dart around lines 526 to 534, the code uses
int.parse(lastCapture.thresholdPercentage) which can throw FormatException or
NPE if thresholdPercentage is null; change this to use safe parsing (int? parsed
= int.tryParse(lastCapture.thresholdPercentage ?? '');) and handle the
null/failed-parse case by treating the capture as invalid (set isValid = false;
break) and optionally log or record the malformed threshold for diagnostics;
ensure no exceptions propagate from parsing so the validation flow continues
safely.

Comment on lines +575 to +584
List<BiometricAttributeData> list = globalProvider.fieldInputValue[field.id!] ?? [];
if (list.isNotEmpty) {
BiometricAttributeData lastCapture = list.last;
if (lastCapture.qualityPercentage < int.parse(lastCapture.thresholdPercentage)) {
isValid = false;
break;
}
}
}

Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Extract duplicated validation logic into a helper method.

This quality validation block is identical to the one at lines 526-534. Duplicate logic increases maintenance burden and bug risk.

🔎 View suggested refactor to eliminate duplication:

Add this helper method to the class:

bool _isLastCaptureQualityValid(String fieldId) {
  List<BiometricAttributeData> list = globalProvider.fieldInputValue[fieldId] ?? [];
  if (list.isEmpty) return true;
  
  BiometricAttributeData lastCapture = list.last;
  int? threshold = int.tryParse(lastCapture.thresholdPercentage);
  if (threshold == null) return true; // or false, depending on policy
  
  return lastCapture.qualityPercentage >= threshold;
}

Then replace both occurrences with:

 if (globalProvider.isValidBiometricCapture) {
-  List<BiometricAttributeData> list = globalProvider.fieldInputValue[field.id!] ?? [];
-  if (list.isNotEmpty) {
-    BiometricAttributeData lastCapture = list.last;
-    if (lastCapture.qualityPercentage < int.parse(lastCapture.thresholdPercentage)) {
-      isValid = false;
-      break;
-    }
-  }
+  if (!_isLastCaptureQualityValid(field.id!)) {
+    isValid = false;
+    break;
+  }
 }

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In lib/ui/process_ui/generic_process.dart around lines 526-534 and 575-584 there
is duplicated last-capture quality validation; extract that logic into a private
helper on the class (e.g. _isLastCaptureQualityValid) that takes the fieldId,
fetches the list from globalProvider.fieldInputValue[fieldId] using a default
empty list, returns true if empty, safely parses threshold with int.tryParse and
returns true on parse failure (or adjust to project policy), and compares
lastCapture.qualityPercentage >= threshold; then replace both duplicated blocks
with a single call to this helper.

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