[results feed] Refactoring: change names of fields in try results code
This change only changes the names of some fields and local variables
Change-Id: Icb8ad5ac63e3c02632f18fd0f74366859dd3444f
Reviewed-on: https://dart-review.googlesource.com/c/dart_ci/+/130802
Reviewed-by: Alexander Thomas <athom@google.com>
diff --git a/results_feed/lib/src/components/try_results_component.dart b/results_feed/lib/src/components/try_results_component.dart
index 128f8bf..1b9ecdb 100644
--- a/results_feed/lib/src/components/try_results_component.dart
+++ b/results_feed/lib/src/components/try_results_component.dart
@@ -39,15 +39,15 @@
TryDataService _tryDataService;
ApplicationRef _applicationRef;
- int change;
- int patch;
- ReviewInfo changeInfo;
+ int review;
+ int patchset;
+ ReviewInfo reviewInfo;
ChangeGroup changeGroup = ChangeGroup(null, {}, [], []);
- int cachedPatch;
- int cachedChange;
+ int cachedReview;
+ int cachedPatchset;
List<Change> changes;
List<Comment> comments;
- IntRange range = IntRange(1, 0);
+ final IntRange emptyRange = IntRange(1, 0);
bool updating = false;
bool updatePending = false;
bool _approving = false;
@@ -82,7 +82,7 @@
: changeGroup.comments.last.baseComment ??
changeGroup.comments.last.id,
[for (Change result in selected) result.id],
- changeInfo.review);
+ reviewInfo.review);
comments
..add(comment)
..sort();
@@ -109,16 +109,16 @@
}
Future<void> update() async {
- if (change == null) return;
- if (changeInfo == null || change != changeInfo.review) {
- changeInfo = await _tryDataService.reviewInfo(change);
+ if (review == null) return;
+ if (reviewInfo == null || review != reviewInfo.review) {
+ reviewInfo = await _tryDataService.fetchReviewInfo(review);
}
- if (change != cachedChange || patch != cachedPatch) {
- changes = await _tryDataService.changes(changeInfo, patch);
- comments = await _tryDataService.comments(changeInfo.review);
+ if (review != cachedReview || patchset != cachedPatchset) {
+ changes = await _tryDataService.changes(reviewInfo, patchset);
+ comments = await _tryDataService.comments(reviewInfo.review);
comments..sort();
- cachedChange = change;
- cachedPatch = patch;
+ cachedReview = review;
+ cachedPatchset = patchset;
changeGroup = ChangeGroup(null, {}, comments, changes);
}
}
@@ -126,9 +126,9 @@
@override
void onActivate(_, RouterState current) {
final changeParam = current.parameters['cl'];
- change = changeParam == null ? null : int.parse(changeParam);
+ review = changeParam == null ? null : int.parse(changeParam);
final patchParam = current.parameters['patch'];
- patch = patchParam == null ? null : int.parse(patchParam);
+ patchset = patchParam == null ? null : int.parse(patchParam);
tryUpdate();
}
}
diff --git a/results_feed/lib/src/components/try_results_component.html b/results_feed/lib/src/components/try_results_component.html
index 9c56399..bf9c4e3 100644
--- a/results_feed/lib/src/components/try_results_component.html
+++ b/results_feed/lib/src/components/try_results_component.html
@@ -1,17 +1,17 @@
-<div *ngIf="changeInfo != null">
+<div *ngIf="reviewInfo != null">
<h2>
- <a href="http://dart-review.googlesource.com/c/sdk/+/{{change}}/{{patch}}"
- target="_blank">{{changeInfo.title}}</a>
+ <a href="http://dart-review.googlesource.com/c/sdk/+/{{review}}/{{patchset}}"
+ target="_blank">{{reviewInfo.title}}</a>
</h2>
<h2 *ngIf="changeGroup.changes.isEmpty">No changed test results</h2>
<results-panel *ngIf="!approving"
[changes]="changeGroup.changes"
- [range]="range">
+ [range]="emptyRange">
</results-panel>
<results-selector-panel *ngIf="approving"
[changes]="changeGroup.changes"
- [range]="range"
+ [range]="emptyRange"
[selected]="selected"
failuresOnly>
</results-selector-panel>
diff --git a/results_feed/lib/src/services/try_data_service.dart b/results_feed/lib/src/services/try_data_service.dart
index 539ddc3..6efc398 100644
--- a/results_feed/lib/src/services/try_data_service.dart
+++ b/results_feed/lib/src/services/try_data_service.dart
@@ -13,24 +13,24 @@
bool get isLoggedIn => _firestoreService.isLoggedIn;
- Future<List<Change>> changes(ReviewInfo changeInfo, int patch) async {
- final patchsets = changeInfo.patchsets;
- if (patchsets.length < patch) return [];
+ Future<List<Change>> changes(ReviewInfo reviewInfo, int patchset) async {
+ final patchsets = reviewInfo.patchsets;
+ if (patchsets.length < patchset) return [];
// Patchset numbers start at 1, not 0.
- int patchsetGroup = patchsets[patch - 1].patchsetGroup;
+ int patchsetGroup = patchsets[patchset - 1].patchsetGroup;
// Workaround while [ ... await foo() ] does not work in dartdevc.
// Issue https://github.com/dart-lang/sdk/issues/38896
final docs = [];
- for (var patchset in patchsets) {
- if (patchset.patchsetGroup == patchsetGroup) {
+ for (var identicalPatchset in patchsets) {
+ if (identicalPatchset.patchsetGroup == patchsetGroup) {
docs.addAll(await _firestoreService.fetchTryChanges(
- changeInfo.review, patchset.number));
+ reviewInfo.review, identicalPatchset.number));
}
}
return [for (final data in docs) Change.fromDocument(data)];
}
- Future<ReviewInfo> reviewInfo(int review) async {
+ Future<ReviewInfo> fetchReviewInfo(int review) async {
final doc = await _firestoreService.fetchReviewInfo(review);
if (doc.exists) {
return ReviewInfo.fromDocument(doc)