Last modified: 2012-03-26 18:10:09 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T28027, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 26027 - SRF: The min and max math formats should work with dates and strings
SRF: The min and max math formats should work with dates and strings
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
SemanticResultFormats (Other open bugs)
unspecified
All All
: Normal minor (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-11-20 19:25 UTC by Dan Bolser
Modified: 2012-03-26 18:10 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Adds two new formats, earliest and latest (2.55 KB, application/octet-stream)
2012-03-25 09:16 UTC, Nischay Nahata
Details
Adds msgs and sets default='' (1.00 KB, patch)
2012-03-26 04:01 UTC, Nischay Nahata
Details

Description Dan Bolser 2010-11-20 19:25:20 UTC
Currently the "format = min" and "format = max" results formats only work with properties with '[[Has type::Number]]'. 

It seems reasonable for at least these two math-type formats to also work with dates, strings, pages, coordinates, etc., etc.


The following page shows an example of the format failing to produce any output (not even a friendly warning) when being called on a non numeric format:

http://scratchpad.referata.com/wiki/SRF_format_min_test


I'm getting round this by using the array extension and a horrible hack ;-)

Cheers,
Dan.
Comment 1 Jeroen De Dauw 2012-03-24 03:34:14 UTC
Removing Denny as assignee.

Dan, why would you want to be able to do this? I can see the use for max and min date/times, but think separate "earliest" and "latest" formats would be more appropriate for those. For the other formats, I really fail to see how having such functions would be useful. What would be a meaningful way to compute the max of a string? Sure you can find way to quantify it, but I doubt they'd be meaningful in more then a few esoteric contexts...
Comment 2 Nischay Nahata 2012-03-25 09:16:16 UTC
Created attachment 10322 [details]
Adds two new formats, earliest and latest
Comment 3 Jeroen De Dauw 2012-03-25 19:47:10 UTC
Applied modified patch in r114481 :)

Stuff that should still be fixed up:

*  The default value is "default"?? That's rather odd. An empty string would make more sense

* Still need to add the messages for the printer name (ie srf_printername_earliest and srf_printername_latest), see https://www.mediawiki.org/wiki/Localisation
Comment 4 Dan Bolser 2012-03-25 19:59:40 UTC
I don't think min(string) is too esoteric, but perhaps that's me. I thought the calculation was self evident, min = first in alphabetic descending sort order, max = opposite, just like in SQL.

I don't see why we should proliferate type specific formats over making the existing formats type agnostic. OK, earliest and latest make for good aliases, but really, is min(date) so confusing? Perhaps I'm not getting something, or perhaps working with SQL has colored my perception, but I don't see the problem here.


Cheers,
Dan.
Comment 5 Nischay Nahata 2012-03-26 04:01:17 UTC
Created attachment 10328 [details]
Adds msgs and sets default=''

I just forgot to send the patch for msgs and [default]=default was done for my own debugging, corrected in this new patch :)
Comment 6 Jeroen De Dauw 2012-03-26 11:59:48 UTC
Great, I applied this in r114486 :)
Comment 7 Yaron Koren 2012-03-26 18:10:09 UTC
Dan - I had the same thought as you did, but then I talked to Jeroen about it, and he convinced me that "earliest" and "latest" are better. There doesn't seem to be a real chance that "min" and "max" functions would be used for anything other than numbers (including values with units) and dates. Given that, it's just cleaner to have all the "math" formats, including min and max, be numbers-only - I think it's simpler for both creating queries, and for the code itself.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links