r75211 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75210‎ | r75211 | r75212 >
Date:18:51, 22 October 2010
Author:jeroendedauw
Status:deferred (Comments)
Tags:
Comment:
Follow up to r75190, added alternate symbols
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/SMW_Settings.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_DataValue.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/SMW_DataValue.php
@@ -422,10 +422,10 @@
423423 case '!~':
424424 $comparator = SMW_CMP_NLKE;
425425 break;
426 - case '>=':
 426+ case '>=': case '≥' :
427427 $comparator = SMW_CMP_GEQ;
428428 break;
429 - case '<=':
 429+ case '<=': case '≤' :
430430 $comparator = SMW_CMP_LEQ;
431431 break;
432432 // default: not possible
Index: trunk/extensions/SemanticMediaWiki/SMW_Settings.php
@@ -203,14 +203,14 @@
204204 * ! (unequal to)
205205 * ~ (pattern with '*' as wildcard, only for Type:String)
206206 * !~ (not a pattern with '*' as wildcard, only for Type:String, need to be placed before ! and ~ to work correctly)
207 - * <= (smaller than or equal to)
208 - * >= (greater than or equal to)
 207+ * <= or ≤(smaller than or equal to)
 208+ * >= or ≥(greater than or equal to)
209209 *
210210 * If unsupported comparators are used, they are treated as part of the queried value
211211 *
212212 * @var string
213213 */
214 -$smwgQComparators = '<|>|!~|!|~|<=|>=';
 214+$smwgQComparators = '<|>|!~|!|~|<=|>=|≤|≥';
215215
216216 ###
217217 # Sets whether the > and < comparators should be strict or not. If they are strict,

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r75190Added mapping between English language name, locale language name and wikiped...diederik15:10, 22 October 2010

Comments

#Comment by Jack Phoenix (talk | contribs)   23:52, 22 October 2010
-				case '>=':
+				case '>=': case '≥' :
 					$comparator = SMW_CMP_GEQ;
 					break;
-				case '<=':
+				case '<=': case '≤' :

I would prefer if this were written like this for better readbility:

				case '>=':
				case '>=':
				case '≥':
 					$comparator = SMW_CMP_GEQ;
					break;
				case '<=':
				case '<=':
				case '≤':
#Comment by Jeroen De Dauw (talk | contribs)   09:03, 23 October 2010

I think that's actually less readible :o

Anyway, an associative array that maps comparator strings to the SMW_CMP_ enum, and thus removes the need for multiple switches, would obviously be better to start with.

Status & tagging log