Bug 21457 - datelastseen and datelastborrowed out of sync
Summary: datelastseen and datelastborrowed out of sync
Status: CLOSED INVALID
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-01 07:57 UTC by Magnus Enger
Modified: 2020-01-06 20:14 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Magnus Enger 2018-10-01 07:57:07 UTC
In the items table we have these two columns:

- datelastborrowed - the date the item was last checked out/issued
- datelastseen - the date the item was last see (usually the last time the barcode was scanned or inventory was done)

Based on these descriptions you would expect that datelastseen was always the same as or more recent than datelastborrowed, right? One of our customer libraries just made me aware that this is not always the case. 

This SQL finds the unexpected data:

SELECT COUNT(*) FROM items WHERE datelastborrowed > datelastseen;

Three of our sites have this unexpected data. They all use SIP2. But we also have a couple sites that use SIP2 that do *not* have unexpected data, so that might be a false lead. 

Anyone else seen this?
Comment 1 Jonathan Druart 2018-11-01 16:36:51 UTC
What are the values?

SELECT datelastborrowed, datelastseen FROM items WHERE datelastborrowed > datelastseen LIMIT 10;
Comment 2 Magnus Enger 2018-11-02 07:16:19 UTC
MariaDB [koha_bth]> SELECT datelastborrowed, datelastseen FROM items WHERE datelastborrowed > datelastseen LIMIT 10;
+------------------+--------------+
| datelastborrowed | datelastseen |
+------------------+--------------+
| 2018-09-13       | 2018-06-25   |
| 2018-09-05       | 2015-10-09   |
| 2018-09-05       | 2018-02-08   |
| 2018-09-10       | 2017-12-14   |
| 2018-06-08       | 2018-04-10   |
| 2018-04-30       | 2016-10-20   |
| 2018-07-10       | 2017-06-08   |
| 2018-01-24       | 2017-01-19   |
| 2018-07-31       | 2018-02-01   |
| 2018-07-10       | 2018-01-16   |
+------------------+--------------+
Comment 3 Jonathan Druart 2019-03-05 18:55:51 UTC
Sorry I do not have any ideas, the code looks ok. Maybe in September 2018 the Koha version was older?
What is the % of items with this problem?
Does it still happen?
Comment 4 Magnus Enger 2019-05-26 17:05:11 UTC
This was either an artifact of the migration to Koha, or it stopped happening in March 2018. Closing.