Skip to content

Commit 6d9c3f4

Browse files
authored
Updated score API: emit null when value is not present, remove updated timestamp (#8922)
1 parent 7b871a4 commit 6d9c3f4

File tree

5 files changed

+8
-22
lines changed

5 files changed

+8
-22
lines changed

app/lib/scorecard/backend.dart

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,7 @@ class ScoreCardBackend {
210210
throw NotFoundException.resource('package "$package" version "$version"');
211211
}
212212

213-
var updated = pkg.updated;
214213
final card = await scoreCardBackend.getScoreCardData(package, v);
215-
if (updated == null || card.updated?.isAfter(updated) == true) {
216-
updated = card.updated;
217-
}
218-
219214
final tags = <String>{
220215
...pkg.getTags(),
221216
...pv.getTags(),
@@ -229,7 +224,6 @@ class ScoreCardBackend {
229224
downloadCount30Days:
230225
downloadCountsBackend.lookup30DaysTotalCounts(package),
231226
tags: tags.toList(),
232-
lastUpdated: updated,
233227
);
234228
}
235229
}

app/test/frontend/handlers/custom_api_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,8 @@ void main() {
180180
'grantedPoints': greaterThan(10),
181181
'maxPoints': greaterThan(50),
182182
'likeCount': 0,
183+
'downloadCount30Days': null,
183184
'tags': contains('sdk:dart'),
184-
'lastUpdated': isNotEmpty,
185185
});
186186
},
187187
);

app/test/package/api_export/api_exporter_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ Future<void> _testExportedApiSynchronization(
155155
'grantedPoints': isNotNull,
156156
'maxPoints': isNotNull,
157157
'likeCount': isNotNull,
158+
'downloadCount30Days': null,
158159
'tags': isNotEmpty,
159-
'lastUpdated': isNotNull,
160160
},
161161
);
162162
expect(

pkg/_pub_shared/lib/data/package_api.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,22 +274,20 @@ class VersionInfo {
274274
Map<String, dynamic> toJson() => _$VersionInfoToJson(this);
275275
}
276276

277-
@JsonSerializable(includeIfNull: false)
277+
@JsonSerializable(includeIfNull: true)
278278
class VersionScore {
279279
final int? grantedPoints;
280280
final int? maxPoints;
281281
final int? likeCount;
282282
final int? downloadCount30Days;
283283
final List<String>? tags;
284-
final DateTime? lastUpdated;
285284

286285
VersionScore({
287286
required this.grantedPoints,
288287
required this.maxPoints,
289288
required this.likeCount,
290289
required this.downloadCount30Days,
291290
required this.tags,
292-
required this.lastUpdated,
293291
});
294292

295293
factory VersionScore.fromJson(Map<String, dynamic> json) =>

pkg/_pub_shared/lib/data/package_api.g.dart

Lines changed: 5 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)