Metadata Edit - Step Up on Integers is broken

Bug #1622757 reported by Better Red on 2016-09-12
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
calibre
Undecided
Charles Haley

Bug Description

When I select the Step up option in an integer value that is Undefined it gets the value -999999, I would have thought a value of 1 would be more appropriate.

If I use the Step Up on an integer column in Bulk MD edit the value in all the selected books changes to -999999 :(

Similar issues with Step Up on floats

I also noticed this for floats. I'm sure I used to see things like '150.00' and '23.40', now I'm now I'm seeing '150' and '23.4' respectively. I have this as the format **{:,2f}**.

BR

Better Red (urbanetiger) wrote :

How about using ↑ ↓ as keyboard shortcuts for Step Up and Step Down

Let's see if this works - <b>{:,2f}</b> :)

Changing the component for this bug.

 assignee cbhaley
 status triaged

Changed in calibre:
assignee: nobody → Charles Haley (cbhaley)
status: New → Triaged
Charles Haley (cbhaley) wrote :

You must be talking about the spinners in edit metadata. Using F2 on the book list sets an undefined value to zero.

Up and down arrow do work.

I cannot repeat the problem with formatting.

Better Red (urbanetiger) wrote :

I am talking about right click menu items Step Up and Step Down in numeric fields, within the metadata editor (single and bulk) or via F2 in the book list - see attachment

Charles Haley (cbhaley) wrote :

Opening an undefined float or int on the booklist already automatically sets the value to zero. The right-click menu does what one expects.

It is true that using the spinner arrows or the right-click step on either bulk or single edit moves from undefined to -999999. I will change this. I say "change" because it isn't actually a bug, but is instead an enhancement.

I don't know what you are referring to when you mention the format.

Better Red (urbanetiger) wrote :

Charles, look at the image I posted. It is the custom columns tab on bulk metadata edit dialogue not the book list. And I am referring to the right click (context) menu items Step Up and Step Down in numeric text boxes not the spinners.

I am attaching another image to this post, which shows the after effects of doing a Step Up in Bulk Metadata Edit - existing values overwritten by -999999 rather than being incremented by 1.

Charles Haley (cbhaley) wrote :

I agree with the issue appearing on the edit dialogs. However, two posts back you said that it appeared via F2, which it does not.

As for the bulk change, that is how it is supposed to work. Bulk edit will replace the value of all books with what you see in that box, be it -999999 or 1. There is no bulk edit function that says "take the current value for this book and add something to it".

Note also that the right-click step up/down do exactly what the spinner arrows do.

Changed in calibre:
status: Triaged → Fix Committed

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

 status fixreleased

Changed in calibre:
status: Fix Committed → Fix Released
Better Red (urbanetiger) wrote :

What do Step Up and Step Down mean. I assumed increment and decrement.

I didn't try to use the spinner arrows, because AFAIK they can only be operated with a pointing device, which I find difficult to do (two hands needed) due injuries. But when I do they don't work in Bulk MDE anyway, which is my primary interest.

If Step Down/Up are not intended to work sensibly in Bulk Edit then why are they not greyed out. And why shouldn't they work, surely they were put there for people like me who for whatever reason prefer not to use pointing devices to click little arrows.

I do admit that I didn't actually use Step up and Step Down via F2 the book list, I only looked to see they they were available in that context. My interest is using them in Bulk metadata edit.

Charles Haley (cbhaley) wrote :

Step Up/Step Down mean increment/decrement the value shown in the box. This is the same meaning as the spinner arrows and cursor up/down when the cursor is in the box. It is the same behavior in bulk edit, single edit, and on the book list. In all cases the value you see *in the box* is the value changed.

One possible source of confusion is that "undefined" has an actual value: -1,000,000. That is why incrementing "undefined" came up with -999,999. My changes make incrementing undefined result in the box containing zero.

The spinner arrows work for me in bulk edit.

As for "sensibly": they do what I expect even though I didn't implement the behavior. You expect something different.

It seems that you want to use bulk edit increment the value in each book. It doesn't do that. However, you can do it in Search & Replace using "Template" as a source. Example:
Search field: template
Template: program: re(add(raw_field('#myint'), 1), "\.0$", "")
Search for: (.*)
Replace with: \1
Destination field: #myint

Better Red (urbanetiger) wrote :

My 'difference' is that I always reach for the context menu first.

When I saw 'Step Up' and 'Step Down' on an integer field in Bulk MDE, I said to myself,

  "Fantastic, that is EXACTLY what I was hoping to see.
   Funny words though - why not 'Increment' or 'Add 1',
   Step Up/Down is something one does to an electric motor" :)

I don't think I even noticed the spinner, and I am still wondering why it's even there in Bulk Edit, it may become clear when the update comes though.

Thanks for the S&R template, it works fine on the book data, but it doesn't appear to 'work' in the test area which confused me for a bit. See attachment

FYI - this relates to the CC Collecting Stats thread

BR

Charles Haley (cbhaley) wrote :

The spinners are there for people who like to use the mouse to change values. One can increment the value in one click. What an amazing thing!

Re the search/replace: the left hand side of the test area shows the input value. In this case that value is the result of evaluating the template, so it is showing the correct info. If you want to see more, use this as the template and the rest from the image.

program: strcat(raw_field('#myint'), ' + 1 = ', re(add(raw_field('#myint'), 1), "\.0$", ""))

The left hand side now shows the original value and the computed value.

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

Other bug subscribers