Last modified: 2007-12-28 10:08:06 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 T14379, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 12379 - Temperature properties don't display conversion for default Celsius
Temperature properties don't display conversion for default Celsius
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
Semantic MediaWiki (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Markus Krötzsch
http://ontoworld.org/wiki/SMW_unit_te...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-12-22 06:55 UTC by S Page
Modified: 2007-12-28 10:08 UTC (History)
0 users

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


Attachments
switch on right variable, also remove unneeded case and addError (review!) (1.35 KB, patch)
2007-12-23 01:34 UTC, S Page
Details

Description S Page 2007-12-22 06:55:01 UTC
If you enter
  [[temperature test::-40 Celsius]]
SMW 1.0-RC3 just shows the temperature, it doesn't show a tooltip with the conversions nor does it show the temperature normalized to K with other values in parentheses in the factbox.

This is a change from 0.7 behavior, which always showed the conversion.

The test page also shows some weirdness with bad or dubious temperature values such as
  [[temperature test::-43F]]
, they don't output any errors.
Comment 1 S Page 2007-12-23 01:34:33 UTC
Created attachment 4461 [details]
switch on right variable, also remove unneeded case and addError (review!)

I don't trust Eclipse Create patch on Windows, here's the patch.

Note the last change: should SMW be aggressive on bad units or flexible?

Index: C:/xampplite/htdocs/mediawiki/extensions/SemanticMediaWiki/includes/SMW_DV_Temperature.php
===================================================================
--- C:/xampplite/htdocs/mediawiki/extensions/SemanticMediaWiki/includes/SMW_DV_Temperature.php	(revision 28741)
+++ C:/xampplite/htdocs/mediawiki/extensions/SemanticMediaWiki/includes/SMW_DV_Temperature.php	(working copy)
@@ -27,7 +27,7 @@
 		// Find current ID and covert main values to Kelvin, if possible
 		// Note: there is no error when unknown units are used.
 		$this->m_unitin = $this->getUnitID($this->m_unit);
-		switch ( $this->m_unit ) {
+		switch ( $this->m_unitin ) {
 			case 'K':
 				$this->m_unit = 'K';
 			break;
@@ -35,7 +35,7 @@
 				$this->m_unit = 'K';
 				$this->m_value = $this->m_value + 273.15;
 			break;
-			case '°F': case 'Fahrenheit':
+			case '°F':
 				$this->m_unit = 'K';
 				$this->m_value = ($this->m_value - 32) /1.8 + 273.15;
 			break;
@@ -40,6 +40,10 @@
 				$this->m_value = ($this->m_value - 32) /1.8 + 273.15;
 			break;
 			default: //unsupported unit
+				// TODO: Should this be an error?  Without addError(), SMW displays 
+				//       and stores your temperature, but doesn't convert it.
+				//       Maybe have an addWarning()? 
+				$this->addError(wfMsgForContent('smw_unsupportedunit',$this->m_unit));
 				$this->m_unit = $this->m_unitin;
 			break;
 		}
Comment 2 Markus Krötzsch 2007-12-28 10:08:06 UTC
OK, I applied that patch manually. I agree that an error message is appropriate for unsupported units here, since unsupported temperature units should be due to typos in almost any case where type:temperature would be used.

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


Navigation
Links