-
Notifications
You must be signed in to change notification settings - Fork 3
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
RTW-321: Deprecate two enum choices #188
Changes from 2 commits
5f80357
5861942
44f24bb
17dfbbc
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 |
---|---|---|
|
@@ -36,10 +36,12 @@ class TestExecutionPopOverState extends ConsumerState<TestExecutionPopOver> { | |
Function(bool?)? getOnChangedCheckboxListTileFunction( | ||
TestExecutionReviewDecision testExecutionReviewDecision, | ||
) { | ||
if ((testExecutionReviewDecision == TestExecutionReviewDecision.rejected && | ||
(_canReject)) || | ||
(testExecutionReviewDecision != TestExecutionReviewDecision.rejected && | ||
_canApprove)) { | ||
if (!testExecutionReviewDecision.isDeprecated && | ||
((testExecutionReviewDecision == TestExecutionReviewDecision.rejected && | ||
_canReject) || | ||
(testExecutionReviewDecision != | ||
TestExecutionReviewDecision.rejected && | ||
_canApprove))) { | ||
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. can you simplify or make this if statement easier to understand somehow? one suggestion is to just create a variable whose name explains 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. I moved the second part in the new variable as suggested, and added a comment that explains what is happening here. |
||
return (bool? value) { | ||
setState(() { | ||
if (reviewDecisions.contains(testExecutionReviewDecision)) { | ||
|
@@ -53,6 +55,11 @@ class TestExecutionPopOverState extends ConsumerState<TestExecutionPopOver> { | |
return null; | ||
} | ||
|
||
bool shouldDisplayDecision(TestExecutionReviewDecision decision) { | ||
return !decision.isDeprecated || | ||
(decision.isDeprecated && reviewDecisions.contains(decision)); | ||
andrejvelichkovski marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
|
@@ -79,12 +86,15 @@ class TestExecutionPopOverState extends ConsumerState<TestExecutionPopOver> { | |
Column( | ||
children: TestExecutionReviewDecision.values | ||
.map( | ||
(e) => YaruCheckboxListTile( | ||
value: reviewDecisions.contains(e), | ||
onChanged: getOnChangedCheckboxListTileFunction(e), | ||
title: Text(e.name), | ||
), | ||
(e) => shouldDisplayDecision(e) | ||
? YaruCheckboxListTile( | ||
value: reviewDecisions.contains(e), | ||
onChanged: getOnChangedCheckboxListTileFunction(e), | ||
title: Text(e.name), | ||
) | ||
: null, | ||
) | ||
.whereType<YaruCheckboxListTile>() | ||
.toList(), | ||
), | ||
const SizedBox(height: Spacing.level4), | ||
|
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.
sorry if I don't know how dart works, but shouldn't it look like this:
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.
According to the Dart docs the empty case falls through, so in this case the logic for
approvedFaultyHardware
continues through and executes the same case asapprovedUnstablePhysicalInfra
.