in src/main/scala/com/gu/liveappversions/android/Updates.scala [15:31]
def getRequiredUpdates(googlePlayVersions: AndroidLiveAppVersions, s3Versions: List[VersionWithTracks]): List[Option[VersionWithTracks]] = {
s3Versions.map { versionWithTracks =>
val currentGooglePlayTracks = VersionWithTracks.toTracks(
beta = googlePlayVersions.currentBeta == versionWithTracks.version,
production = googlePlayVersions.currentProduction == versionWithTracks.version)
val version = versionWithTracks.version
val s3TrackHistory = versionWithTracks.tracks
val fullTrackHistory: Set[Track] = s3TrackHistory ++ currentGooglePlayTracks // Duplicates will be removed as we're using Set
if (fullTrackHistory.equals(s3TrackHistory)) {
logger.info(s"File in s3 for version $version is up to date, no update required")
None
} else {
logger.info(s"File in s3 for version $version requires updates. Previous track info $s3TrackHistory | New track info: $fullTrackHistory")
Some(VersionWithTracks(version, fullTrackHistory))
}
}
}