I created a module that allows users to add a race time field to their content types. Other date/time fields are specific to the time of day, while this one is specific to competitive times, which are measured in minutes, seconds and tenths, hundredths or thousandths of a second. The module creates a new field type that stores the time entered as an integer, first converting the time to a floating point time in seconds and then multiplies it by the number of decimal places to get a full integer. For example, a time of 1:25.58 is first converted to seconds (i.e. 85.58) and then multiplied by 100 to convert it to an integer (i.e. 8558).

There is an associated javascript file that formats the time when a user enters the value. For example, when s/he entered 12585, the javascript will convert it to 1:25.58 (adding the colon and decimal point).

I have a sandbox project set up located at https://drupal.org/sandbox/robbertv/2158841

The project repository is at git.drupal.org/sandbox/robbertv/2158841.git

This is the only project I've worked on for Drupal.org, but I have a Drupal based website with about 20 custom modules located at http://www.oregonswimming.org/. These modules are specific to Oregon Swimming, and don't belong on Drupal.

Reviews for this project

CommentFileSizeAuthor
#30 coder-results.txt1.55 KBklausi

Comments

PA robot’s picture

Status: Needs review » Needs work

There are some errors reported by automated review tools, did you already check them? See http://pareview.sh/pareview/httpgitdrupalorgsandboxrobbertv2158841git

We are currently quite busy with all the project applications and we prefer projects with a review bonus. Please help reviewing and put yourself on the high priority list, then we will take a look at your project right away :-)

Also, you should get your friends, colleagues or other community members involved to review this application. Let them go through the review checklist and post a comment that sets this issue to "needs work" (they found some problems with the project) or "reviewed & tested by the community" (they found no major flaws).

I'm a robot and this is an automated message from Project Applications Scraper.

robbertv’s picture

I have fixed the issues found with pareview.

robbertv’s picture

Status: Needs work » Needs review
abhishek-anand’s picture

Hi,

You code is still on master branch, move it to 7.x-1.x. Read more at https://drupal.org/empty-git-master

format.js - has lines which is not terminated by ; (semicolon). Please correct formatting issues as per JavaScript coding standards. https://drupal.org/node/172169

format.js - Review the inline comments as per Doxygen formatting conventions. Exceeds 80 chars (http://drupal.org/node/1354)

abhishek-anand’s picture

Status: Needs review » Needs work
robbertv’s picture

I have corrected the issues with format.js and set 7.x-1.x to be the default branch. I cannot delete the master branch and I'm guessing it's because I don't have permission to do so.

robbertv’s picture

Status: Needs work » Needs review
abhishek-anand’s picture

Go to your module page >> Edit >> Default branch and set 7.x as your default branch. Then you will be able to delete the master branch by $git push origin :master

m1n0’s picture

Status: Needs review » Needs work
robbertv’s picture

Status: Needs work » Needs review

The branch has been deleted and the javascript file has been updated.

michel_v’s picture

Hi

Thanks for your contribution, I've reviewed your module and have found the following minor issues:

1. racetime_validate($element)
function doesn't actually do anything?

2. racetime.module line 362
missed the d of formatted

As a note, I found it a bit confusing that the field type added is called Time, perhaps it should be called Race Time, as per the module name.

Also I was expecting it to appear as a widget for Date, rather than it's own field type..

Thank you

Michel

robbertv’s picture

Thank you for your feedback. I've fixed the typos and removed the unused function. It was there for future development.

This project is unrelated to anything that a Date field can deliver since the times are carried out up to the thousandths of a second, which date cannot do. Also, times are stored as an integer due to the fact that fractions of a second are used.

arlina’s picture

Hi robbertv,

I agree with michel_v that the field type should be called as the module name. I also found the following issues when reviewing your module:

  • In racetime_field_widget_form(): $widget['#description'] currently reads "Add description here". Please change it to a useful message that instructs users the correct format the input should have, like the number of decimals expected. Could be something like: "Enter time in 00:00.00 format" or "123456 will be interpreted as 12:34.56".
  • When playing with the jquery widget I experienced some unexpected behavior. I have configured a field with 2 decimals, and say I want a value of 1 second. The following happens:
    • input => parsed
    • 1 or 1. => .1
    • 1.0 => .10
    • 1.00 => 10:1.00

    I know I can just type "000100" to be parsed as "00:01.00", but it just doesn't feel as natural, and it would be a great UI improvement if you could take this into account.

Cheers!

arlina’s picture

Status: Needs review » Needs work
robbertv’s picture

Status: Needs work » Needs review
robbertv’s picture

Status: Needs review » Needs work
robbertv’s picture

Issue summary: View changes
Status: Needs work » Needs review

Thank you for the feedback. I have changed the field type and fixed the bug in format.js

jmaerckaert’s picture

I tested your module and it works as expected.

robbertv’s picture

How long does it take to approve a project? It's been 3 months since I submitted and 2 since anything has been added.

izus’s picture

Status: Needs review » Needs work

hi,
i read the code and here are ny notes :

- in hook_field_schema
'time' => array( can we please name the column 'racetime' as the providing module name ?

- in the .module file
1) racetime_field_widget_form(& $form, &$form_state, $field, $instance, $langcode, $items, $delta, $element)
there shouldn't be a space between & and $form.

2) isset ($items[$delta]['time']) should be isset($items[$delta]['time']) (no space after the function name)

-in _racetime_add_js
Same space issues :
1) & drupal_static(__FUNCTION__); => &drupal_static(__FUNCTION__);
2) !empty ($racetime_js_added) => !empty($racetime_js_added)
Actually, i'm not sure what _racetime_add_js() is for. as it returns nothing, i don't see how the drupal_static will be used. i guess the need is to add the js file only once in the page call, this is already the case with drupal_add_js for files, it adds them once.

-about the js file
We need to have a Js Drupal behavior for this : https://drupal.org/node/304258#drupal-behaviors

Thanks

robbertv’s picture

Status: Needs work » Reviewed & tested by the community

I've made a couple of the coding changes. However, I do not see the need to change the column name. Many columns use value or value2. Also _racetime_add_js() adds the JS file needed to format the entered time. It doesn't actually use the document.ready or other features as described in the drupal-behaviors link you provided.

robbertv’s picture

Hi, just checking in to see if this will ever be approved.

klausi’s picture

We are currently quite busy with all the project applications and I can only review projects with a review bonus. Please help me reviewing and I'll take a look at your project right away :-)

robbertv’s picture

Issue summary: View changes
robbertv’s picture

Issue summary: View changes
robbertv’s picture

Issue tags: +PAreview: review bonus
robbertv’s picture

Issue summary: View changes
robbertv’s picture

Status: Reviewed & tested by the community » Needs review

Review bonus completed. Hopefully, my project can now be approved.

klausi’s picture

Assigned: Unassigned » pushpinderchauhan
Status: Needs review » Reviewed & tested by the community
Issue tags: -PAreview: review bonus

Thank you for your reviews. When finishing your review comment also set the issue status either to "needs work" (you found blocking problems with the project) or "reviewed & tested by the community" (you found no major flaws). Could you go back to those and set the status accordingly?

Review of the 7.x-1.x branch (commit e41333c):

This automated report was generated with PAReview.sh, your friendly project application review script. You can also use the online version to check your project. You have to get a review bonus to get a review from me.

manual review:

  1. "@returns {string}" should be "@return string", see https://www.drupal.org/coding-standards/docs#return
  2. racetime_field_formatter_settings_summary(): shouldn't this show an example format how the value will be displayed?
  3. _racetime_add_js() is unused and can be removed?
  4. theme_racetime(): the implode() is just complicating the code here, why don't you just put the class directly into $html?

But otherwise looks good to me, setting to RTBC. Removing review bonus tag, you can add it again if you have done another 3 reviews of other projects.

Assigning to er.pushpinderrana as he might have time to take a final look at this.

klausi’s picture

StatusFileSize
new1.55 KB

Oops, forgot attachment.

robbertv’s picture

I have fixed the issues found. Thanks for the feedback.

robbertv’s picture

Issue summary: View changes
robbertv’s picture

Issue summary: View changes
robbertv’s picture

Issue summary: View changes
Issue tags: +PAreview: review bonus
pushpinderchauhan’s picture

Assigned: pushpinderchauhan » Unassigned
Status: Reviewed & tested by the community » Fixed

Automated Review

Best practice issues identified by pareview.sh / drupalcs / coder. Yes, few below issues.

Review of the 7.x-1.x branch (commit c2238ab):

FILE: /var/www/drupal-7-pareview/pareview_temp/format.js
--------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------
13 | ERROR | Doc comment short description must be on a single line, further
| | text should be a separate paragraph
80 | ERROR | Inline comments must end in full-stops, exclamation marks, or
| | question marks
--------------------------------------------------------------------------------

Manual Review

Project Page: Extend this little bit more, better to go through Tips for a great project page again.

(+) racetime.module: <?PHP ALLCAPS is a bad taste instead it should be <?php.

I tested this module functionality and found for invalid time it shows Invalid Time alert message but don't prevent the form submission. It should stop form submission with appropriate message for better user experience.

The starred items (*) are fairly big issues and warrant going back to Needs Work. Items marked with a plus sign (+) are important and should be addressed before a stable project release. The rest of the comments in the code walkthrough are recommendations.

Inline comments and docs looks good to me so...

Thanks for your contribution, robbertv!

I updated your account so you can promote this to a full project and also create new projects as either a sandbox or a "full" project.

Here are some recommended readings to help with excellent maintainership:

You can find lots more contributors chatting on IRC in #drupal-contribute. So, come hang out and stay involved!

Thanks, also, for your patience with the review process. Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.

Thanks to the dedicated reviewer(s) as well.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.