Bugzilla – Attachment 23494 Details for
Bug 11279
Quote of the day feature won't pick a quote
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11279: Improve how a new quote of the day is selected
Bug-11279-Improve-how-a-new-quote-of-the-day-is-se.patch (text/plain), 1.84 KB, created by
Katrin Fischer
on 2013-12-12 20:02:38 UTC
(
hide
)
Description:
Bug 11279: Improve how a new quote of the day is selected
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2013-12-12 20:02:38 UTC
Size:
1.84 KB
patch
obsolete
>From 5ba080c439a2afcf06efb79cd18375cc66be4d00 Mon Sep 17 00:00:00 2001 >From: Katrin Fischer <Katrin.Fischer.83@web.de> >Date: Thu, 12 Dec 2013 00:54:08 +0100 >Subject: [PATCH] Bug 11279: Improve how a new quote of the day is selected > >When a lot of quotes were deleted, it's possible that no >new quote will be selected. This will happen when a lot of >the older quotes with low ids have been deleted. > >This patch improves the selection of a new quote. > >To test: >- Load sample quotes >- Delete the first half of the quotes. > Note: With 34 quotes, delete the quotes with ids from 1-17 >- Activate the QuoteOfTheDay system preference >- Check if a quote is displayed in OPAC >- Reload the page a few times, no quote should be displayed > Note: make sure you don't have a quote with the current > date in your quotes table before running those tests >- Run 'perl t/db_dependent/Koha.t' > Note: requires sample quotes! >- Apply patch >- Reload the OPAC start page >- Verify a quote was now picked >- Run 'perl t/db/dependent/Koha.t' again - all tests should still pass >--- > C4/Koha.pm | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > >diff --git a/C4/Koha.pm b/C4/Koha.pm >index 937ac5f..7faf7ca 100644 >--- a/C4/Koha.pm >+++ b/C4/Koha.pm >@@ -1443,11 +1443,11 @@ sub GetDailyQuote { > my $range = ($sth->fetchrow_array)[0]; > if ($range > 1) { > # chose a random id within that range if there is more than one quote >- my $id = int(rand($range)); >+ my $offset = int(rand($range)); > # grab it >- $query = 'SELECT * FROM quotes WHERE id = ?;'; >+ $query = 'SELECT * FROM quotes ORDER BY id LIMIT ?, 1;'; > $sth = C4::Context->dbh->prepare($query); >- $sth->execute($id); >+ $sth->execute($offset); > } > else { > $query = 'SELECT * FROM quotes;'; >-- >1.8.3.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 11279
:
23493
|
23494
|
23662
|
23663
|
23668
|
23669
|
23670