Commit c7ee525a authored by nanahira's avatar nanahira

ignore version field entirely

parent 6e3b109c
Pipeline #15348 canceled with stages
in 2 minutes and 46 seconds
......@@ -30,6 +30,7 @@ export class UpdateService extends ConsoleLogger {
(a) => a.displayData
);
const appVersionCacheMap = new Map<string, string>();
const foundApps = new Set<string>();
for (const _platform of Object.values(AppsJson.Platform)) {
const platform = _platform as AppsJson.Platform;
if (platform === 'generic') {
......@@ -41,40 +42,41 @@ export class UpdateService extends ConsoleLogger {
depotDto.platform = platform;*/
// this.log(platform);
for (const app of data) {
if (app.version?.[platform]) {
// this.log(`Try fetching latest version of ${app.id} ${platform}`);
const tryCache = appVersionCacheMap.get(app.id);
if (tryCache) {
app.version[platform] = tryCache;
}
app.version ??= {};
const tryCache = appVersionCacheMap.get(app.id);
if (tryCache) {
app.version[platform] = tryCache;
}
const latestBuild = await this.db
.getRepository(Build)
.createQueryBuilder('build')
.select(['build.version', 'build.id', 'depot.platform'])
.innerJoin('build.depot', 'depot')
.where('depot.appId = :appId', { appId: app.id })
.andWhere(
new Brackets((qb) =>
qb
.where('depot.platform = :genericPlatform', { genericPlatform: Platform.generic })
.orWhere('depot.platform = :platform', { platform })
)
const latestBuild = await this.db
.getRepository(Build)
.createQueryBuilder('build')
.select(['build.version', 'build.id', 'depot.platform'])
.innerJoin('build.depot', 'depot')
.where('depot.appId = :appId', { appId: app.id })
.andWhere(
new Brackets((qb) =>
qb
.where('depot.platform = :genericPlatform', { genericPlatform: Platform.generic })
.orWhere('depot.platform = :platform', { platform })
)
.orderBy('build.id', 'DESC')
.take(1)
.getOne();
if (latestBuild) {
const latestVersion = latestBuild.version;
if (latestBuild.depot.platform === 'generic') {
appVersionCacheMap.set(app.id, latestVersion);
}
app.version[platform] = latestVersion;
)
.orderBy('build.id', 'DESC')
.take(1)
.getOne();
if (latestBuild) {
if (!foundApps.has(app.id)) {
foundApps.add(app.id);
}
const latestVersion = latestBuild.version;
if (latestBuild.depot.platform === 'generic') {
appVersionCacheMap.set(app.id, latestVersion);
}
app.version[platform] = latestVersion;
}
}
}
return data;
return data.filter((app) => foundApps.has(app.id));
}
private async getBuild(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment