After updating metadata (i.e. new cover) home made date column (YYYY) is adjusted too

Bug #1217096 reported by Dirk-Jan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Fix Released
Undecided
Unassigned

Bug Description

When I make a change to the metadata for the columnbrowser, my home made column 'copyright' is changed too. By example;
My 'Copyright' column has a value 2012. After adding a cover for the book and saving the data, the value isn't 2012, but 2011. Always the value minus 1. This is since version 1.0.

I'm running Calibre Win 64 with Win 8.

Revision history for this message
Kovid Goyal (kovid) wrote : Re: calibre bug 1217096

What template are you using for your custom column? Go to
Preferences->Add yourown columns and click the button with the blue i on
it to see information about the column.

 status incomplete

Changed in calibre:
status: New → Incomplete
Revision history for this message
Charles Haley (cbhaley) wrote :

@Kovid: this is reproducible. Steps for my timezone (GMT-1)

1) Create a custom date column. Set the template to yyyy
2) In calibre 0.9.44, set the column to 2013.
3) Still in 0.9.44, hover your mouse over the date. You will see 2013-01-01T00:00:00
4) Switch to calibre 1.0.0. The cell shows 2013
5) Select the book, open edit metadata (single)
6) Press OK.
7) The cell shows 2012. Hovering shows 2012-12-31T23:00:00

It seems like the date is being converted to UTC by edit metadata, but is not being converted to localtime when displayed. I will try to validate this theory.

Revision history for this message
Kovid Goyal (kovid) wrote :

@charles: newdb returns all dates as UTC, for performance reasons. olddb used to return local timezone dates. I suspect the custom date widgets will have to be updated to take that into account.

Revision history for this message
Charles Haley (cbhaley) wrote :

First, in my post above I should have said (GMT + 1).

OK, more info. The dates below are printed in gui2.library.models.py

Here is the raw date in 0.9.44:
  0.9.44: 2013-01-01 00:00:00+01:00
Note that my timezone is marked at +01:00. This is literally true, but does not take into consideration daylight savings time. I am currently 2 hours ahead of UTC, one hour ahead of GMT (actually BST).

Here is the date in 1.0.0 before editing it.
  ('raw', datetime.datetime(2012, 12, 31, 23, 0, tzinfo=tzutc()))
  ('local', PyQt4.QtCore.QDateTime(2013, 1, 1, 0, 0))
It has been converted to UTC based on the +01:00 timezone. This seems reasonable.

Here is the date after editing it:
  ('raw', datetime.datetime(2012, 12, 31, 22, 0, tzinfo=tzutc()))
  ('local', PyQt4.QtCore.QDateTime(2012, 12, 31, 23, 0))
Somehow we have lost an hour in the original date.

Revision history for this message
Charles Haley (cbhaley) wrote :

Found it. The problem is in gui2.custom_column_widgets. Will commit the fix after testing more.

Revision history for this message
Charles Haley (cbhaley) wrote :

Apologies for all the extra chatter. I didn't see your response until after my last post.

Fix committed.

Unfortunately, any values in the database that became wrong will remain wrong. There is no way to recover the previous value. They need to be manually corrected.

Revision history for this message
Kovid Goyal (kovid) wrote :

Thanks for the fix.

Revision history for this message
Kovid Goyal (kovid) wrote : Fixed in master

Fixed in branch master. The fix will be in the next release. calibre is usually released every Friday.

 status fixreleased

Changed in calibre:
status: Incomplete → Fix Released
Revision history for this message
Dirk-Jan (djg) wrote : RE: [Bug 1217096] Re: After updating metadata (i.e. new cover) home made date column (YYYY) is adjusted too

Hi guys,

thanks for the very quick solution. Doesn't matter that I have to correct the changed values manually.

May I take the opportunity to tell you about another situation I experienced? Maybe I should open a bug report, but until no wit isn't reproducable.

In my free time I order my db by author and from above I open a book, try to find a missing issue (per example a cover, an isbn or in this case also the copyright date) and change this data.

Saturday I installed version 1.0 and Sunday I changed some metadata in the program from where I stopped last Friday. I approximately changed 25 book records.

Yesterday I had some time during the day and changed some other books over the day where the problem occured with the changed date for "copyright". But there was a point that I saw a bookrecord that, according to the last changedate, was already changed on 26-08-2013 and I was sure I didn't change it. I am working alpabetically, so I was pretty sure of it. Yesterday evening I saw a simular situation and sorted the books on last change date. Where I was sure I should see about a 50 books with the changedate of 26-08-2013, I saw 1600 books with this date and most of them on T 08:03:42. Now I now that was pretty much the time I closed the program mand I'm sure too I didn't made a mass update. It are books with all letters of the alphabet (sorted by author), so I know I couldn't have made the selection if I wanted.

I'm afraid there must be something that changed this date automatically and maybe even after installing the programm. I only know that I just before the timestamp of 08:03:42 I saw the new cover grid and tried it.

I can't reproduce the fault for as far that I can see (maybe there are more changes). Do I have to report this as a bug?

Hope to hear from you,

Best regards,

Dirk-Jan Guldemond

-----Oorspronkelijk bericht-----
Van: <email address hidden> [mailto:<email address hidden>] Namens Charles Haley
Verzonden: dinsdag 27 augustus 2013 11:40
Aan: <email address hidden>
Onderwerp: [Bug 1217096] Re: After updating metadata (i.e. new cover) home made date column (YYYY) is adjusted too

Apologies for all the extra chatter. I didn't see your response until after my last post.

Fix committed.

Unfortunately, any values in the database that became wrong will remain wrong. There is no way to recover the previous value. They need to be manually corrected.

--
You received this bug notification because you are subscribed to the bug report.
https://bugs.launchpad.net/bugs/1217096

Title:
  After updating metadata (i.e. new cover) home made date column (YYYY)
  is adjusted too

Status in calibre: e-book management:
  Incomplete

Bug description:
  When I make a change to the metadata for the columnbrowser, my home made column 'copyright' is changed too. By example;
  My 'Copyright' column has a value 2012. After adding a cover for the book and saving the data, the value isn't 2012, but 2011. Always the value minus 1. This is since version 1.0.

  I'm running Calibre Win 64 with Win 8.

To manage notifications about this bug go to:
https://bugs.launchpad.net/calibre/+bug/1217096/+subscriptions

Revision history for this message
Kovid Goyal (kovid) wrote : Re: calibre bug 1217096

When you change an author's name or sort or author link, all books by
that author get modified. Same for tags and series and so on., The new
database is much more strict than the old one about this.

Revision history for this message
Dirk-Jan (djg) wrote : RE: [Bug 1217096] Re: calibre bug 1217096

Hi,

Thanks for the explanation. Last night I finally succeeded to find the one thing that connect the changed records. I have a column where I make a notition of something that I have to adjust in the future. One ot that notitions is "Index", what triggers me that I have to build an index for the book. In every column I let all the expressions bein with a capital because I hate to see two possibillities for the same expression (index, Index) in a combobox. I know I changed one "Index" by mistake to "index". I wanted to test this tonight, but now I'm sure this is what's caused to change the last change date.

Does this mean that when I import a book with a label "thriller" that all my books with the label "Thriller" change? Or is the label from the imported book adjusted to the label from my database?

Best regards,
Dirk-jan

-----Oorspronkelijk bericht-----
Van: <email address hidden> [mailto:<email address hidden>] Namens Kovid Goyal
Verzonden: woensdag 28 augustus 2013 04:42
Aan: <email address hidden>
Onderwerp: [Bug 1217096] Re: calibre bug 1217096

When you change an author's name or sort or author link, all books by that author get modified. Same for tags and series and so on., The new database is much more strict than the old one about this.

--
You received this bug notification because you are subscribed to the bug report.
https://bugs.launchpad.net/bugs/1217096

Title:
  After updating metadata (i.e. new cover) home made date column (YYYY)
  is adjusted too

Status in calibre: e-book management:
  Fix Released

Bug description:
  When I make a change to the metadata for the columnbrowser, my home made column 'copyright' is changed too. By example;
  My 'Copyright' column has a value 2012. After adding a cover for the book and saving the data, the value isn't 2012, but 2011. Always the value minus 1. This is since version 1.0.

  I'm running Calibre Win 64 with Win 8.

To manage notifications about this bug go to:
https://bugs.launchpad.net/calibre/+bug/1217096/+subscriptions

Revision history for this message
Kovid Goyal (kovid) wrote : Re: calibre bug 1217096

Imorting should not change the values of existing items, instead the
imported books metadata is changed to match existing items.

Revision history for this message
Dirk-Jan (djg) wrote : RE: [Bug 1217096] Re: calibre bug 1217096

Thanks!

-----Oorspronkelijk bericht-----
Van: <email address hidden> [mailto:<email address hidden>] Namens Kovid Goyal
Verzonden: woensdag 28 augustus 2013 14:56
Aan: <email address hidden>
Onderwerp: [Bug 1217096] Re: calibre bug 1217096

Imorting should not change the values of existing items, instead the imported books metadata is changed to match existing items.

--
You received this bug notification because you are subscribed to the bug report.
https://bugs.launchpad.net/bugs/1217096

Title:
  After updating metadata (i.e. new cover) home made date column (YYYY)
  is adjusted too

Status in calibre: e-book management:
  Fix Released

Bug description:
  When I make a change to the metadata for the columnbrowser, my home made column 'copyright' is changed too. By example;
  My 'Copyright' column has a value 2012. After adding a cover for the book and saving the data, the value isn't 2012, but 2011. Always the value minus 1. This is since version 1.0.

  I'm running Calibre Win 64 with Win 8.

To manage notifications about this bug go to:
https://bugs.launchpad.net/calibre/+bug/1217096/+subscriptions

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.