Select the latest file based on priority channels

This commit is contained in:
Dean Campbell
2020-11-04 17:07:34 -08:00
parent 02846c220d
commit 70788fca40

View File

@@ -34,6 +34,8 @@ export class GetAddonListItem {
}
public getLatestFile(channel: AddonChannelType): AddonSearchResultFile {
return _.find(this.searchResult.files, (f) => f.channelType <= channel);
let files = _.filter(this.searchResult.files, (f) => f.channelType <= channel);
files = _.orderBy(files, ["releaseDate"]).reverse();
return _.first(files);
}
}