Skip to content

Commit

Permalink
Rename test executions count to environment reviews count
Browse files Browse the repository at this point in the history
  • Loading branch information
omar-selo committed Oct 8, 2024
1 parent b454878 commit 5c03aa7
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 25 deletions.
4 changes: 2 additions & 2 deletions frontend/benchmarks/common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ class ApiRepositoryMock extends Mock implements ApiRepository {
status: ArtefactStatus.undecided,
stage: StageName.beta,
bugLink: '',
allTestExecutionsCount: 1,
completedTestExecutionsCount: 0,
allEnvironmentReviewsCount: 1,
completedEnvironmentReviewsCount: 0,
);

return {
Expand Down
10 changes: 5 additions & 5 deletions frontend/lib/models/artefact.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ class Artefact with _$Artefact {
required String repo,
required ArtefactStatus status,
required StageName stage,
@JsonKey(name: 'all_test_executions_count')
required int allTestExecutionsCount,
@JsonKey(name: 'completed_test_executions_count')
required int completedTestExecutionsCount,
@JsonKey(name: 'all_environment_reviews_count')
required int allEnvironmentReviewsCount,
@JsonKey(name: 'completed_environment_reviews_count')
required int completedEnvironmentReviewsCount,
User? assignee,
@JsonKey(name: 'bug_link') required String bugLink,
@JsonKey(name: 'due_date') DateTime? dueDate,
Expand All @@ -44,7 +44,7 @@ class Artefact with _$Artefact {
}

int get remainingTestExecutionCount =>
allTestExecutionsCount - completedTestExecutionsCount;
allEnvironmentReviewsCount - completedEnvironmentReviewsCount;
}

const List<String> monthNames = [
Expand Down
5 changes: 3 additions & 2 deletions frontend/lib/providers/artefact.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ class Artefact extends _$Artefact {
state = AsyncData(artefact);
}

Future<void> updateCompletedTestExecutionsCount(int count) async {
Future<void> updatecompletedEnvironmentReviewsCount(int count) async {
final artefact = await future;
state = AsyncData(artefact.copyWith(completedTestExecutionsCount: count));
state =
AsyncData(artefact.copyWith(completedEnvironmentReviewsCount: count));
}
}
6 changes: 4 additions & 2 deletions frontend/lib/providers/review_test_execution.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ReviewTestExecution extends _$ReviewTestExecution {
final artefactBuilds =
ref.read(artefactBuildsProvider(artefactId)).requireValue;

final newCompletedTestExecutionsCount = artefactBuilds
final newcompletedEnvironmentReviewsCount = artefactBuilds
.map(
(build) => build.testExecutions
.where((testExecution) => testExecution.reviewDecision.isNotEmpty)
Expand All @@ -40,6 +40,8 @@ class ReviewTestExecution extends _$ReviewTestExecution {

await ref
.read(artefactProvider(artefactId).notifier)
.updateCompletedTestExecutionsCount(newCompletedTestExecutionsCount);
.updatecompletedEnvironmentReviewsCount(
newcompletedEnvironmentReviewsCount,
);
}
}
5 changes: 3 additions & 2 deletions frontend/lib/ui/artefact_page/artefact_page_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ class ArtefactPageHeader extends StatelessWidget {
if (assignee != null)
UserAvatar(
user: assignee,
allTestExecutionsCount: artefact.allTestExecutionsCount,
completedTestExecutionsCount: artefact.completedTestExecutionsCount,
allEnvironmentReviewsCount: artefact.allEnvironmentReviewsCount,
completedEnvironmentReviewsCount:
artefact.completedEnvironmentReviewsCount,
),
const SizedBox(width: Spacing.level4),
if (dueDate != null)
Expand Down
7 changes: 4 additions & 3 deletions frontend/lib/ui/dashboard/artefact_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@ class ArtefactCard extends ConsumerWidget {
if (assignee != null)
UserAvatar(
user: assignee,
allTestExecutionsCount: artefact.allTestExecutionsCount,
completedTestExecutionsCount:
artefact.completedTestExecutionsCount,
allEnvironmentReviewsCount:
artefact.allEnvironmentReviewsCount,
completedEnvironmentReviewsCount:
artefact.completedEnvironmentReviewsCount,
),
],
),
Expand Down
14 changes: 7 additions & 7 deletions frontend/lib/ui/user_avatar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,26 @@ class UserAvatar extends StatelessWidget {
const UserAvatar({
super.key,
required this.user,
required this.allTestExecutionsCount,
required this.completedTestExecutionsCount,
required this.allEnvironmentReviewsCount,
required this.completedEnvironmentReviewsCount,
});

final User user;
final int allTestExecutionsCount;
final int completedTestExecutionsCount;
final int allEnvironmentReviewsCount;
final int completedEnvironmentReviewsCount;

double get ratioCompleted {
if (allTestExecutionsCount == 0) {
if (allEnvironmentReviewsCount == 0) {
return 0.0;
}
return completedTestExecutionsCount / allTestExecutionsCount;
return completedEnvironmentReviewsCount / allEnvironmentReviewsCount;
}

@override
Widget build(BuildContext context) {
return Tooltip(
message:
'${user.name}\n${user.launchpadHandle}\n${user.launchpadEmail}\nCompleted: $completedTestExecutionsCount / $allTestExecutionsCount (${(ratioCompleted * 100).round()}%)',
'${user.name}\n${user.launchpadHandle}\n${user.launchpadEmail}\nCompleted: $completedEnvironmentReviewsCount / $allEnvironmentReviewsCount (${(ratioCompleted * 100).round()}%)',
child: Stack(
alignment: Alignment.center,
children: [
Expand Down
4 changes: 2 additions & 2 deletions frontend/test/dummy_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ const dummyArtefact = Artefact(
stage: StageName.beta,
assignee: dummyUser,
bugLink: '',
allTestExecutionsCount: 1,
completedTestExecutionsCount: 0,
allEnvironmentReviewsCount: 1,
completedEnvironmentReviewsCount: 0,
);

const dummyEnvironment = Environment(
Expand Down

0 comments on commit 5c03aa7

Please sign in to comment.