Commit 229cff71 authored by TravisCarden's avatar TravisCarden

By TravisCarden: Made a few very minor code improvements.

parent 1ef7a9c8
...@@ -142,7 +142,7 @@ class ChecklistapiChecklist { ...@@ -142,7 +142,7 @@ class ChecklistapiChecklist {
public function saveProgress(array $values) { public function saveProgress(array $values) {
global $user; global $user;
$time = time(); $time = time();
$changed_items_counter = 0; $num_changed_items = 0;
$progress = array( $progress = array(
'#changed' => $time, '#changed' => $time,
'#changed_by' => $user->uid, '#changed_by' => $user->uid,
...@@ -170,7 +170,7 @@ class ChecklistapiChecklist { ...@@ -170,7 +170,7 @@ class ChecklistapiChecklist {
'#completed' => $time, '#completed' => $time,
'#uid' => $user->uid, '#uid' => $user->uid,
); );
$changed_items_counter++; $num_changed_items++;
} }
} }
else { else {
...@@ -178,7 +178,7 @@ class ChecklistapiChecklist { ...@@ -178,7 +178,7 @@ class ChecklistapiChecklist {
$new_item = 0; $new_item = 0;
if ($old_item) { if ($old_item) {
// Item was previously checked. // Item was previously checked.
$changed_items_counter++; $num_changed_items++;
} }
} }
$progress[$item_key] = $new_item; $progress[$item_key] = $new_item;
...@@ -192,7 +192,7 @@ class ChecklistapiChecklist { ...@@ -192,7 +192,7 @@ class ChecklistapiChecklist {
variable_set($this->getSavedProgressVariableName(), $progress); variable_set($this->getSavedProgressVariableName(), $progress);
drupal_set_message(format_plural( drupal_set_message(format_plural(
$changed_items_counter, $num_changed_items,
'Checklist %title has been updated. 1 item changed.', 'Checklist %title has been updated. 1 item changed.',
'Checklist %title has been updated. @count items changed.', 'Checklist %title has been updated. @count items changed.',
array('%title' => $this->title) array('%title' => $this->title)
......
...@@ -55,8 +55,7 @@ class ChecklistapiUnitTestCase extends DrupalUnitTestCase { ...@@ -55,8 +55,7 @@ class ChecklistapiUnitTestCase extends DrupalUnitTestCase {
* Test checklistapi_strtolowercamel(). * Test checklistapi_strtolowercamel().
*/ */
public function testChecklistapiStrtolowercamel() { public function testChecklistapiStrtolowercamel() {
$output = checklistapi_strtolowercamel('Abc def_ghi'); $this->assertEqual(checklistapi_strtolowercamel('Abc def_ghi'), 'abcDefGhi', 'Converted string to lowerCamel case.');
$this->assertEqual($output, 'abcDefGhi', 'Converted string to lowerCamel case.');
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment