Standardize terminology on either 'status' or 'state', not both.

dww - January 1, 2009 - 20:31
Project:Project issue tracking
Version:6.x-1.x-dev
Component:User interface
Category:bug report
Priority:normal
Assigned:willmoy
Status:needs review
Issue tags:6.x-1.0 blocker
Description

While looking through the code working on something else, I noticed that in some places, we call "active", "fixed", etc the "Status" of an issue. I believe we're fairly consistent about that in the UI, otherwise, I'd call this a bug. However, the underlying code sometimes calls it a "status" and other times calls it a "state". We should standardize completely, rename functions + variables, etc. We should do this during/after the D6 port.

#1

dww - January 1, 2009 - 21:04
Component:Issues» User interface
Category:task» bug report

Bah, this is a UI bug, since there are a few places we use "state" in the UI:

A) At node/N/edit/issues, we use "States" as the header above the checkboxes, and mention "states" in the help text.

B) The help text for the "Auto-close days" setting at admin/project/project-issue-settings

C) The URL for issue query pages uses "states=1,2,3..." as the GET parameter name

I still think we should only fix this in D6, since it's going to cause URL link rot in the case of (C), which we're going to face anyway as we convert all issue listings to views.

#2

aclight - April 26, 2009 - 16:17

Adding 6.x-1.0 blocker tag.

#3

willmoy - September 24, 2009 - 21:57
Assigned to:Anonymous» willmoy

There are—
324 uses of 'state' in project_issue
178 left after you replace the strings as in patterns.sed
32 left after you ignore $form_state

Those 32 are mainly natural language (comments, t() strings) and I can patch those manually.

The rest can be solved by running:
find project_issue_HEAD/ -type f -exec sed -i -f patterns.sed {} \;

patterns.sed is attached as patterns_sed.txt. A patch against HEAD is also attached, if this is a convenient time to apply it.

I don't have an install I can test the patch on but I have proof read it carefully.

This patch is by way of meagre thanks for all your hard work on this system.

AttachmentSize
issue-353248.patch 48.33 KB
patterns_sed.txt 1009 bytes

#4

willmoy - September 24, 2009 - 21:58
Status:active» needs review

#5

dww - September 24, 2009 - 22:15
Status:needs review» needs work

Very cool, thanks! One glaring omission from this patch is that if the following happens:

-    $result = db_query('SELECT * FROM {project_issue_state} ORDER BY weight');
-    while ($state = db_fetch_object($result)) {
-      $options[] = $state;
+    $result = db_query('SELECT * FROM {project_issue_status} ORDER BY weight');
+    while ($status = db_fetch_object($result)) {
+      $options[] = $status;

then we definitely need to add a project_issue_update_6003() to rename this table. ;)

Otherwise, quick skim looks pretty good... Don't have time right now for a more in depth review, but this is off to a great start, especially since it's automated as a sed script, not a big patch to manually reroll all the time. ;)

Thanks again!
-Derek

#6

willmoy - September 24, 2009 - 23:08

Right you are. You see, if you want something done properly, you have to do it yourself ;)

Patch attached, for the table rename on its own. New function:

<?php
/**
* Rename {project_issue_state} to {project_issue_status}
*/
function project_issue_update_6003() {
 
$ret = array();
 
db_rename_table($ret, 'project_issue_state', 'project_issue_status');
  return
$ret;
}
?>

AttachmentSize
issue-353248-table-rename.patch 664 bytes

#7

dww - September 24, 2009 - 23:55
Status:needs work» needs review

Great, thanks. ;) Back to "needs review"...

#8

marcp - October 6, 2009 - 22:36

Anyone get a chance to test these patches yet?

 
 

Drupal is a registered trademark of Dries Buytaert.