-
Notifications
You must be signed in to change notification settings - Fork 72
While packet creating Threshold values and score values are giving same, continue button is not enable in biometric page #628
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
base: develop
Are you sure you want to change the base?
Changes from all commits
71c8e68
a02dccf
d9c67a1
77e7338
cce232c
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 |
|---|---|---|
|
|
@@ -523,9 +523,16 @@ class _GenericProcessState extends State<GenericProcess> | |
| break; | ||
| } | ||
| if (globalProvider.isValidBiometricCapture) { | ||
| isValid = false; | ||
| break; | ||
| List<BiometricAttributeData> list = globalProvider.fieldInputValue[field.id!] ?? []; | ||
| if (list.isNotEmpty) { | ||
| BiometricAttributeData lastCapture = list.last; | ||
| if (lastCapture.qualityPercentage < int.parse(lastCapture.thresholdPercentage)) { | ||
| isValid = false; | ||
| break; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| } | ||
| } | ||
| } | ||
|
|
@@ -565,9 +572,16 @@ class _GenericProcessState extends State<GenericProcess> | |
| break; | ||
| } | ||
| if (globalProvider.isValidBiometricCapture) { | ||
| isValid = false; | ||
| break; | ||
| List<BiometricAttributeData> list = globalProvider.fieldInputValue[field.id!] ?? []; | ||
| if (list.isNotEmpty) { | ||
| BiometricAttributeData lastCapture = list.last; | ||
| if (lastCapture.qualityPercentage < int.parse(lastCapture.thresholdPercentage)) { | ||
| isValid = false; | ||
| break; | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
Comment on lines
+575
to
+584
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. 🛠️ 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;
+ }
}
🤖 Prompt for AI Agents |
||
| } | ||
| } | ||
| if (response.compareTo( | ||
|
|
||
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.
Add error handling for threshold parsing.
int.parse()will throw aFormatExceptionifthresholdPercentageis 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
🤖 Prompt for AI Agents