This module provides a Wilks Calculator.

The Wilks Coefficient or Wilks Formula is a coefficient that can be used to measure the strength of a powerlifter against other powerlifters despite the different weights of the lifters. Robert Wilks is the author of the formula.

- Wikipedia

Project: https://drupal.org/sandbox/godslonelyman/2223039
GIT: git clone --branch 7.x-1.x git.drupal.org:sandbox/godslonelyman/2223039 wilks_calculator

Comments

wolfwood’s picture

Status: Active » Needs review
PA robot’s picture

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.

alinouman’s picture

Status: Needs review » Needs work

Hi wolf,
Nice effort, some points in code review and testing.
1- In your javascript you have implicity declared global javascript 8 times. For eg FnWilksFormula = {, gender = jQuery(form).find('input[name=wf_gender]:checked').val();
It is very worst practice see this answer for more http://stackoverflow.com/a/6888584/974181
You can use jslint to check these kind of errors.
2- You have two big arrays with 100's of value. I am amazed that how you have type it?. Can you not calculate it on fly(some function)? Because it is making code almost unreadable.
3- On sumbit function form submits and one cannot see value. You have to make it ajax here to atleast user could see the results.
4- Have you look into ajax forms in drupal 7 https://drupal.org/node/752056 . You could all this without writing javascript,jquery and using ajax forms, it will be much more acceptable to drupal standard.

Thanks

wolfwood’s picture

Status: Needs work » Needs review

Thanks for the review!

1. I've updated the js by removing the globals
2. The array are copied from a spreadsheet. I thought it would be easier to use, faster and less accident prone than having to calculate it. But you're right maybe replacing it with a function/calculation is better.
3. The form isn't supposed to submit and before it didn't ... in Chrome. I've added a "return false" since "event.preventDefault();" didn't work in some (FireFox) browsers.
4. For now I don't want to implement ajax because that will add another server call. And JS can do the calculation just as well without a (slower) server call. I hope that's acceptable?

Janke Consulting’s picture

Status: Needs review » Needs work

An automated review of your project has found some issues with your code; As coding standards make sure projects are coded in a consistent style we please you to have a look at the report and try to fix them. Anyway, note that issues found are possibly false positives and fixing all issues is not a requirement for getting through the application process.

You can find the results of the automated report at http://pareview.sh/pareview/httpgitdrupalorgsandboxgodslonelyman2223039git

kevla’s picture

I've just run the same automated review as Janke did.

It looks like they're false positives. So no big deal there.

One thing that I noticed is that you're using jQuery instead of $. If your code is inside the

(function($){})(jQuery)

Then you can use $.

One more suggestion I would have is that instead of using drupal_add_js (which is going to be deprecated in D8) I'd recommend moving to using a render array with the #attached key. https://drupal.org/node/930760

wolfwood’s picture

Finally had time to look at it!

I made some more changes to the js based on the review and jslint. I only get one last error for numbers like: 1.291E-08 (anybody who can tell me the name of that notation?). Not all browsers seem to like it if I put a space in there.

kcmanc87's suggestion to add the js file to the render array has also been implemented. :)

wolfwood’s picture

Status: Needs work » Needs review
ram4nd’s picture

  • Po files seem obsolete.
  • Also, I think that screenshot is obsolete.
  • wilks_calculator.module starts with ";<?php", the mark in front of "<?php" is a typo or something i think
  • wilks_calculator.js has 4 space indents, should be 2
  • js comments are not up to standards
izus’s picture

Status: Needs review » Needs work

settings the status as per #9

wolfwood’s picture

Status: Needs work » Needs review

What is wrong with the po file and the screenshot?
I put up a new screenshot which looks a bit better just in case. The po files seems fine, it works and all texts are needed.

Removed the typo in front of <?php, reduced the space indents from 4 to 2 and added a bit more comments to the js. :)

ram4nd’s picture

Why not use ajax functionality built in Drupal. That way it works when you don't have JavaScript enabled as well.

http://browse-tutorials.com/tutorial/create-ajax-forms-drupal-7

wolfwood’s picture

How would you make an ajax call with javascript disabled?

joachim’s picture

Status: Needs review » Needs work

Po files are obsolete.

function wilks_calculator_block_content() {
  $form = drupal_get_form('wilks_calculator_form');
  $output = render($form);

  return $output;
}

You don't need to render the form. See how user_block_view() does it.

Also, if this function is only has three lines (and one is about to be removed), you're better off folding it into wilks_calculator_block_view(). Especially as then you don't need the return, so you've only one line.

function wilks_calculator_form() {

Missing form builder params.
Also, no need to document the return for form handlers, as their signature is standard.

    'type' => 'file');

The ) should be on a new line.

    '#title' => t('Gender:'),

Don't include the ':'. Form API does that sort of thing.

 * @file
 * Javascript for the Wilks Formula Calculator.

Why are you doing all of the calculation in JS?

ram4nd’s picture

No, it will work regardless. If javascript is enabled it will use ajax for it, if not then page refresh. Also the code has to be in php as suggested.

joachim’s picture

> If javascript is enabled it will use ajax for it, if not then page refresh.

I don't see how that can be possible, as all the code to perform the calculation is in JS. AFAICT there is no PHP code for doing that -- maybe I missed it?

wolfwood’s picture

Status: Needs work » Needs review

I think ram4nd means that's possible after putting the code in PHP, but I put the calculation in JS basically because it's a bit faster (on a slow (shared hosting)server a php request just feels really slow.

The rest of your recommendations are implemented, joachim. :)

gisle’s picture

Status: Needs review » Needs work

Automated Review

OK.

(PAReview.sh output http://pareview.sh/pareview/httpgitdrupalorgsandboxgodslonelyman2223039git are false positives.)

Manual Review

Individual user account
Yes: User wolfwood follows the guidelines for individual user accounts.
No multiple applications
Yes
No duplication
Yes.
Master Branch
Yes: Follows the guidelines for master branch. (git clone instructions is wrong tho').
Licensing
Yes: Follows the licensing requirements
3rd party code
Yes: Follows the guidelines for 3rd party code.
README.txt
No: README.md exists, but doen't contain any meaningful information about installation, use or limitations. It does not inform the user that JavaScript must be enabled for the module to work. It does not follow the guidelines for in-project documentation and the README.txt Template.
Code long/complex enough for review
No: The project is only 70 lines of PHP code (after stripping comments and blanks). It is basically a block form that calls an JavaScript that computes the Wilks coefficient. It is too simple to count as a real module, and it is really a bare bones implementation, as it does not perform any checks to make sure it has a suitable environment to run in or meaningful error messages, It does not follow the guidelines for project length and complexity. In its current state, it is IMHO too bare bones and provide a too unsatisfactory UX to deserve promotion to a full project. It doesn't even use Drupal's AJAX framework. Unless given an extensive redesign, it is a special interest project best suited for a sandbox. And in any way, a larger and more complex project should have been submitted for review for full git access. (But I shall leave it to a git admin to make a final call on this.)
Secure code
Yes. If "no", list security issues identified.
Coding style & Drupal API usage
  • (*) .po files are obsolete and must be removed from the repo. Translations are done on http://localize.drupal.org.
  • (*) The screenshot.jpg servers no purpose, and must be removed from the repo. We don't host repos on Drupal.org that contains random bits and pieces that is not used by the project and it is not explained in the README.txt why they are included.
  • In my browser (Firefox), the input numbers and Wilks coeffiscient where all visible for about a second after pressing the button, then the form automatically reset. I don't know whether this is a bug or by design, but it was not a good UX.
  • Should use Drupal's AJAX Framework (as suggested in #12).
  • (*) The module only works when JavaScript is enabled. When JavaScript is disabled, nothing happens when the user press the "Calculate Wilks Total" button. As a minimum, there should be a meaningful error message, or better: The whole Wilks block is replaced with a suitable message if JavaScript is disabled. (Using Drupal's AJAX Framework would make this point moot, but requires an extensive redesign of project.)

The starred items (*) are fairly big issues and warrant going back to Needs Work. The rest of the comments in the code walkthrough are recommendations.

gisle’s picture

Adding tag.

PA robot’s picture

Status: Needs work » Closed (won't fix)

Closing due to lack of activity. If you are still working on this application, you should fix all known problems and then set the status to "Needs review". (See also the project application workflow).

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