Bug 3688 - Pagebar offset incorrect (off by one)
: Pagebar offset incorrect (off by one)
Status: RESOLVED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Web Interface
: 6.5b1
: All All
: P2 trivial (vote)
: ---
Assigned To: Dan Sully
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-07-03 01:22 UTC by Johan Broberg
Modified: 2008-09-15 14:39 UTC (History)
2 users (show)

See Also:
Category: ---


Attachments
Patch (796 bytes, patch)
2006-07-03 01:24 UTC, Johan Broberg
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Johan Broberg 2006-07-03 01:22:08 UTC
The pagebar offset in the web interface is incorrect (clicking on "A" shows you all entries beginning with "B").

This patch (to server/Slim/Web/Pages.pm) should fix it.

Index: Pages.pm
===================================================================
--- Pages.pm	(revision 8256)
+++ Pages.pm	(working copy)
@@ -378,6 +378,7 @@
 
 		my $first = $results->first;
 
+		# Set offset for first letter row to 0 (no utf8decode here?)
 		$alphamap{$first->get_column('letter')} = 0;
 
 		$itemCount += $first->get_column('count');
@@ -387,9 +388,11 @@
 			my $count  = $row->get_column('count');
 			my $letter = $row->get_column('letter');
 
+			# Set offset for subsequent letter rows to current $itemCount
+			# (*before* we add number of items for this letter to $itemCount!)
+			$alphamap{Slim::Utils::Unicode::utf8decode($letter)} = $itemCount;
+
 			$itemCount += $count;
-
-			$alphamap{Slim::Utils::Unicode::utf8decode($letter)} = $itemCount;
 		}
 
 	} else {
Comment 1 Johan Broberg 2006-07-03 01:24:54 UTC
Created attachment 1314 [details]
Patch
Comment 2 KDF 2006-07-03 01:54:46 UTC
possibly related to bug 3540
Comment 3 Johan Broberg 2006-07-03 02:09:02 UTC
Yes, this should fix 3540. I probably should have submitted this patch there, but didn't find that bug as I was searching for "pagebar"...
Comment 4 KDF 2006-07-03 10:29:30 UTC
saerch is hard with so many ways of expressing things.  Searching through the comments, instead of the summaries is usually a bit more efffective.  Use the advanced search to do this.
Comment 5 Dan Sully 2006-07-05 11:43:37 UTC
Fixed in change 8290

Thanks
Comment 6 Dan Sully 2006-07-06 11:25:00 UTC
*** Bug 3540 has been marked as a duplicate of this bug. ***