diff --git a/app/models/package.rb b/app/models/package.rb index 04b51ea..2af10ea 100644 --- a/app/models/package.rb +++ b/app/models/package.rb @@ -53,6 +53,12 @@ class Package < ActiveRecord::Base end # Return the newest screenshot that is not newer than the given version. + # This algorithm collects all image + # versions of a package and determines the (second) newest version. + # E.g. if there are version 1.0 and 2.0 and the user is looking for + # a screenshot of version 1.5 then the 1.0 version is returned. + # This way the user does not see a screenshot of version 2.0 because + # 2.0 might contain features that were not there in version 1.5. def best_screenshot_for_version(version) sorted_screenshots = self.screenshots_sorted_by_version sorted_screenshots.each do |ss|