wolph / alfred-converter

Alfred unit converter is a smart calculator for Alfred with support for unit conversions to make it a bit comparable to the Google Calculator and Wolfram Alpha.
93 stars 15 forks source link

Megameter vs millimeter #15

Closed surbitron closed 5 years ago

surbitron commented 5 years ago

This is s really useful plug-in - well done. I have a request regarding Megameters and millimetres. In version 2.0 if we enter a length in millimeters (mm) the plug-in thinks we are talking Megameters (Mm).

1 millimeters (mm) = 0.001 meters 1 megameter (Mm) = 1,000,000 meters

Can you please fix this so that 'mm' translates to millimeters and 'Mm' translates to megameter, in much the way as you have for bits (b) and Bytes (B)? Many thanks.

surbitron commented 5 years ago

Scrub that - Sorry for the noise!

wolph commented 5 years ago

It would be possible to fix the sorting of the results but that's often not too convenient since it depends on your use-case. So currently the sorting is decided by alfred which means you can easily change it yourself :)

Simply select the result with the millimeter a few times (enter 1mm or so and press enter on the mm conversion you prefer) and Alfred will teach itself :)

surbitron commented 5 years ago

Yes, I realised my mistake almost immediately after posting. Thanks for the swift response!

Dilapidus commented 5 years ago

But the only things you will see when you put 1mm into the alfred search box are things that start with 1 Megameter. There are lots of them (dozens). But there is nothing like 1 mm = blah blah

wolph commented 5 years ago

Initially, yes. Unfortunately I don't think I can influence the sorting that Alfred does (except completely overriding it) and the auto prioritizing system of Alfred is actually very convenient in many cases.

Once you've selected millimeter out of all of the options once or twice, it will show those first the next time.

Dilapidus commented 5 years ago

"Once you've selected ..." I don't think I can. That's what I was trying to say. There is not one item on the list that starts with 1 mm.

Dilapidus commented 5 years ago

Sorry... to be perfectly clear: When I type "1 mm" into Alfred, I get a couple dozen (at least) options, each and every one of which starts with "1 Megameter = " so there is no "1 Millimeter = " option for me get pushed to the top of alfred's stack.

image

As you can see, it does  seem to be doing the right thing numerically when use it. It just seems to call Millimeters Megameters.

wolph commented 5 years ago

You found a bug indeed @Dilapidus, when there are 2 units with the same annotation but only a case difference it was non-deterministic which order was used. Since the results are cached though, it effectively resulted in some people not being able to use millimeter.

I've fixed the bug so it initially attempts the exact case, if that fails it will fall back to case insensitive searches.

Can you give it a try? :)

Dilapidus commented 5 years ago

image

Much better, thanks! I still wonder that 1mm = 1 Megameter but that's ok, I had never heard of a megameter before this.

wolph commented 5 years ago

Yeah, that's definitely wrong. I think it must be some kind of overflow somehow but I haven't been able to track down the cause.

Dilapidus commented 5 years ago

I promise you I will never care :-)