This module creates a questions and answers area similar to StackOverflow and Yahoo Answers.

Admins can Create Sections, which can then have different Question and Answers. Both Questions and Answers are fieldable allowing the admin to specify which fields. e.g. - Admin creates a two sections, Cars and Boats. Questions/Answer in the Cars Section can have totally different fields than those in the Boats section.

Sections also have the ability to limit by role, users that are able to ask a question and users that are able to answer a question. Users also have the ability to vote on answers by way of the voting api, as well as the ability to chose the best answer.

Project page: http://drupal.org/sandbox/jadams/1748094

GIT link: http://git.drupal.org/sandbox/jadams/1748094
GIT clone: git clone --recursive --branch 7.1-1.1 http://git.drupal.org:sandbox/jadams/1748094.git qa

Comments

d2ev’s picture

Status: Needs review » Needs work

hi... you have a lot of things to check here http://ventral.org/pareview/httpgitdrupalorgsandboxjadams1748094

1. qa.module :
You have functions that have only one line of code.. try to optimize it

**
 * Title callback for Questions & Answers Entities.
 * 
 * @param type $qa
 * @return type
 */
function qa_title($qa){
  return $qa->title;
}

/**
 * Page Title callback for Section Entities.
 * 
 * @param type $section
 * @return type
 */
function qa_section_uri($section){
  return array(
    'path' => 'qa/section/' . $section->id,
  );
}

/**
 * Page Title callback for Question Entities.
 * 
 * @param type $question
 * @return type
 */
function qa_question_uri($question){
  return array(
    'path' => 'qa/question/' . $question->id,
  );
}

/**
 * Page Title callback for Answer Entities.
 * 
 * @param type $answer
 * @return type
 */
function qa_answer_uri($answer){
  return array(
    'path' => 'qa/answer/' . $answer->id,
  );
}

2. It is very difficult to go through your code now. But don't forget to delete variable you have defined in your module in unistall() hook.

3. you have some empty and i hope some misplaced files like qa_answer.inc, qa_question.inc, qa_section.inc

j.adams’s picture

Status: Needs work » Needs review

I apologize. It seems that gave you an older version that was very rough. But I went through and made all the needed adjustments as well as making sure that it is all up to drupal code standards. Thanks!

aritra.ghosh’s picture

Status: Needs review » Needs work

Hii,

Please work on following issues:

1. Remove "version" from the info file, it will be added by drupal.org packaging automatically.
2. Remove minor issues pointed out by drupal code sniffer.

Manual Review:

There are some sections like this in the module file:

function qa_section_save($section) {
  entity_save('qa_section', $section);
}

3. Do you plan to reuse them at some point of time later? apparently you are not implementing any logic in there for now except for calling functions like entity_delete(). Are those required to be in seperate functions?

4. Similarly there are lots of functions with only 2-3 lines of code. Please try to optimise these.

Thanks,
Aritra

codycraven’s picture

Aritra,

Regarding #3 and 4:

As a module developer I find functions like ENTITY_TYPE_save() intuitive based on the way Drupal core operates, see: node_load(); node_delete(); and, although longer, having the same naming convention, node_save().

For that reason I think these short wrapper functions do have reason enough to belong, as they will save me, and other outside developers, time from hunting trying to figure out whether the module it utilizing Entity API or some custom function with a non-intuitive name for saving the entities.

j.adams’s picture

I agree with codycraven. Those functions while simple are needed and provide an easy to use solution for developers not familiar with the entity api. I also verified with coder-review that there were no formatting issues.

j.adams’s picture

Status: Needs work » Needs review
petreej’s picture

Status: Needs review » Needs work

Hi,

I got this error after installing the module, you might be missing dependencies in your info file.

Fatal error: Class 'panels_display' not found in sites/all/modules/questions___answers/panels/pages/question.inc on line 51

Also, you have a lot of issues with coding standards as seen here:
http://ventral.org/pareview/httpgitdrupalorgsandboxjadams1748094

Regards,
Pete

sinasalek’s picture

Have you tried Answers module?

jpstrikesback’s picture

I get the following error upon enabling the module:

Fatal error: Class 'panels_display' not found in /home/sdf6c30372b8ea5d/www/sites/default/modules/1748094/panels/pages/section.inc on line 51

PA robot’s picture

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

Closing due to lack of activity. Feel free to reopen if you are still working on this application.

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