Skip to content

Commit 0df2769

Browse files
committed
feat: consider full version of testing packages in package matrix
1 parent 67b9a1c commit 0df2769

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/sql.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pub const SQL_GET_PACKAGE_TESTING: &str = "
22
SELECT
3-
version,
3+
full_version,
44
spec_path,
55
tree,
66
branch

src/views/package.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ pub async fn packages(RoutePackage { name }: RoutePackage, q: Query, db: Ext) ->
9090

9191
#[derive(FromRow)]
9292
struct PackageTesting {
93-
pub version: String,
93+
pub full_version: String,
9494
pub tree: String,
9595
pub branch: String,
9696
pub spec_path: String,
@@ -151,26 +151,26 @@ pub async fn packages(RoutePackage { name }: RoutePackage, q: Query, db: Ext) ->
151151
.fetch_all(&db.meta)
152152
.await?;
153153
let mut testing_ver_count = HashMap::new();
154-
testing_vers.iter().for_each(|PackageTesting { version, .. }| {
154+
testing_vers.iter().for_each(|PackageTesting { full_version, .. }| {
155155
testing_ver_count
156-
.entry(version.clone())
156+
.entry(full_version.clone())
157157
.and_modify(|e| *e += 1)
158158
.or_insert(1);
159159
});
160160
let testing_vers: HashMap<_, _> = testing_vers
161161
.into_iter()
162162
.map(|testing| {
163-
let version = if testing_ver_count[&testing.version] >= 2 {
164-
let version = &testing.version;
163+
let full_version = if testing_ver_count[&testing.full_version] >= 2 {
164+
let version = &testing.full_version;
165165
let branch = testing
166166
.branch
167167
.strip_prefix("origin/")
168168
.unwrap_or(testing.branch.as_str());
169169
format!("{version}-{branch}")
170170
} else {
171-
testing.version.clone()
171+
testing.full_version.clone()
172172
};
173-
(version, testing)
173+
(full_version, testing)
174174
})
175175
.collect();
176176

0 commit comments

Comments
 (0)