Bug 307223 - group selected by time not grouping one pair per album
Summary: group selected by time not grouping one pair per album
Status: RESOLVED FIXED
Alias: None
Product: digikam
Classification: Applications
Component: Albums-ItemGroup (show other bugs)
Version: 2.9.0
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Digikam Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-22 17:38 UTC by Marek Potocki
Modified: 2017-07-29 05:29 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 3.0.0


Attachments
error0.png (318.07 KB, image/png)
2012-09-22 19:02 UTC, Marek Potocki
Details
error1.png (458.94 KB, image/png)
2012-09-22 19:02 UTC, Marek Potocki
Details
description for checking the date (186.69 KB, image/png)
2012-09-24 16:16 UTC, Smit Mehta
Details
group1.jpg (284.02 KB, image/jpeg)
2012-11-03 16:50 UTC, Marek Potocki
Details
group2.jpg (135.44 KB, image/jpeg)
2012-11-03 16:50 UTC, Marek Potocki
Details
group1a.jpg (291.94 KB, image/jpeg)
2012-11-03 16:50 UTC, Marek Potocki
Details
group2a.jpg (176.28 KB, image/jpeg)
2012-11-03 16:50 UTC, Marek Potocki
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marek Potocki 2012-09-22 17:38:33 UTC
When I group all photos in album (RAW+JPEG) by time, it work's except one pair.

Reproducible: Always

Steps to Reproduce:
1. go to album with photo pairs RAW+JPEG
2. select all
3. use function group selected by time (or similar - I don't use English version)
Actual Results:  
All files are grouped, except one (in first 10). Sometimes problem not appear.


KDE 4.8.5
Comment 1 Smit Mehta 2012-09-22 18:39:54 UTC
Created attachment 74095 [details]
error0.png

Hi Marek

Can you please send me two screenshots? One showing the group option you select and other showing the problem in the image area? It doesnt need to be in English. We will figure that out.

Thanks.

Smit
Comment 2 Marek Potocki 2012-09-22 19:02:56 UTC
> Can you please send me two screenshots? One showing the group option you select
> and other showing the problem in the image area? It doesnt need to be in
> English. We will figure that out.

OK, they are two screenshots
error0.png: polish option "Pogrupuj wybrane wg. czasu" (translate
error - properly "wg." is without dot at end)
error1.png: photo DSC05096.(ARW and JPG) aren't groupped. when I
change sort order, photo with error is another.
Comment 3 Marek Potocki 2012-09-22 19:02:57 UTC
Created attachment 74096 [details]
error1.png
Comment 4 Smit Mehta 2012-09-24 16:13:23 UTC
Hi Marek

I am not able to reproduce it here. However it might be possible that the time might be different by "seconds". to check that
(a) click on captions/tags on the right pane
(b) check the date and time

i have attached a screenshot to guide you how to reproduce the above steps.

if both are same for both the "raw" and "jpeg" image, then send those files to me here.

Smit
Comment 5 Smit Mehta 2012-09-24 16:16:38 UTC
Created attachment 74130 [details]
description for checking the date
Comment 6 Marek Potocki 2012-10-28 19:19:48 UTC
I found regularity of this bug. I click right button of mouse for display context menu over one of photos, and pair with this file is not created.
Comment 7 Smit Mehta 2012-11-03 15:07:29 UTC
Created attachment 74965 [details]
group1.jpg

Hi Marek

I am not sure what you mean by your last comment. Can you give some screenshot of what you are referring to?

Smit
Comment 8 Marek Potocki 2012-11-03 16:50:43 UTC
2012/11/3 Smit Mehta <smit.meh@gmail.com>:
> https://bugs.kde.org/show_bug.cgi?id=307223
>
> --- Comment #7 from Smit Mehta <smit.meh@gmail.com> ---
> Hi Marek
>
> I am not sure what you mean by your last comment. Can you give some screenshot
> of what you are referring to?

OK. Step by step:

1. I select all photos in album, and open context menu over any photo
in my example - IMG_0230.JPG (screen1.jpg)
2. After select group by time (pogrupuj wybrane wg czasu), all
selected files are grouped, exclude pair with this photo (screen2.jpg)
BUT
Bug doesn't appear when context menu is opened over any photo from
first pair in album (screen1a.jpg and screen2a.jpg)
Comment 9 Marek Potocki 2012-11-03 16:50:44 UTC
Created attachment 74966 [details]
group2.jpg
Comment 10 Marek Potocki 2012-11-03 16:50:44 UTC
Created attachment 74967 [details]
group1a.jpg
Comment 11 Marek Potocki 2012-11-03 16:50:44 UTC
Created attachment 74968 [details]
group2a.jpg
Comment 12 Marcel Wiesweg 2012-11-04 11:00:58 UTC
Marek, thanks for your precise analysis.
Smit, look at DigikamImageView::createGroupByTimeFromSelection(), first line:
    QList<ImageInfo> selectedInfos = selectedImageInfosCurrentFirst();

"CurrentFirst" -> current info is prepended in the list, thus out of order. Can be replaced by the more simple selectedImageInfos().
Why is that a problem at all? The algorithm is simple, but seems to imply that the infos are sorted by date, which is often the case, but in no way guaranteed. Easiest way to fix is to qSort() the list with a custom lessThan method which sorts by date/time.
When it comes to nit-picking optimization, an algorithm which only iterates (by incrementing index or iterator) without editing the list (takeFirst) will be slightly more efficient.
Comment 13 Marcel Wiesweg 2013-01-12 17:51:51 UTC
Git commit 729399dcd5bf63046097ed3e479e2d2906ed82cc by Marcel Wiesweg.
Committed on 12/01/2013 at 18:47.
Pushed by mwiesweg into branch 'master'.

Rewrite algorithm for grouping by time:
- sort list by date, dont take this state for granted
- iterator-based on read-only list, less expensive than list editing
Works for me, testing appreciated.

M  +27   -8    digikam/items/digikamimageview.cpp

http://commits.kde.org/digikam/729399dcd5bf63046097ed3e479e2d2906ed82cc