fix major BUG : changeOrder can bump inferior photo to head. Plus: added... #2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
... MPixel to the size comparison
the comparison between head and new, based on a sequence of parameters, should be lexicographical.
Only proceed to next if current parameters are found equal !
As it was, an inferior new photo could be bumped to head.
eg : image A is raw, but not rated. image B is a jpg export, rated 4 stars, and the rating option is set.
When this function analyses B, it does not enter the RAW comparison block, goes on, then compares superior to A in the RATING block.
Result : photo A (the RAW) is flagged for deletion, while B (the jpg duplicate) is kept.
Dangerous behaviour, this could lead to lose user's RAW masters !
more elegant solution would be to build a function (like act) from the activated options, which is then used to map photos to tuple (RAW, MPixels, size, ...), then use lexicographical order on that tuple.
But I've just started using Lua today to fix that plugin and I don't know how to do it that way, so I just added a plain boolean "continueOrder" ...
About MPixels : exporting a jpg to a smaller res can very well result in larger fileSize. On the other hand, one never upsamples a file when exporting. So using MPixels before fileSize is a good idea.