Skip to content

Commit

Permalink
Dev: simplified QuotaMember.php
Browse files Browse the repository at this point in the history
  • Loading branch information
lacrioque committed Mar 28, 2017
1 parent 52066f8 commit b3ef63e
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions application/models/QuotaMember.php
Expand Up @@ -73,30 +73,32 @@ public function primaryKey()
public function getMemberInfo()
{
$sFieldName = "0";
if ($this->question->type == "I" || $this->question->type == "G" || $this->question->type == "Y")
{
$sFieldName=$this->sid.'X'.$this->question->gid.'X'.$this->qid;
$sValue = $this->code;
}

if($this->question->type == "L" || $this->question->type == "O" || $this->question->type =="!")
{
$sFieldName=$this->sid.'X'.$this->question->gid.'X'.$this->qid;
$sValue = $this->code;
}
$sValue = "";

if($this->question->type == "M")
{
$sFieldName=$this->sid.'X'.$this->question->gid.'X'.$this->qid.$this->code;
$sValue = "Y";
switch($this->question->type) {
case "I":
case "G":
case "H":
$sFieldName=$this->sid.'X'.$this->question->gid.'X'.$this->qid;
$sValue = $this->code;
break;
case "L":
case "O":
case "!":
$sFieldName=$this->sid.'X'.$this->question->gid.'X'.$this->qid;
$sValue = $this->code;
break;
case "M":
$this->sid.'X'.$this->question->gid.'X'.$this->qid.$this->code; $sValue = "Y";

This comment has been minimized.

Copy link
@lacrioque

lacrioque Mar 28, 2017

Author Contributor

A newline is missing.

This comment has been minimized.

Copy link
@Shnoulle

Shnoulle Mar 28, 2017

Collaborator

And a quote closed

This comment has been minimized.

Copy link
@TonisOrmisson

TonisOrmisson Mar 28, 2017

Collaborator

this $this->sid.'X'.$this->question->gid.'X'.$this->qid.$this->code; is doing nothing.
missing $sFieldName= ??

This comment has been minimized.

Copy link
@lacrioque

lacrioque Mar 29, 2017

Author Contributor

You are right.
Fix on the way

break;
case "A":
case "B":
$temp = explode('-',$this->code);
$sFieldName=$this->sid->sid.'X'.$this->question->gid.'X'.$this->qid.$temp[0];
$sValue = $temp[1];
break;
}

if($this->question->type == "A" || $this->question->type == "B")
{
$temp = explode('-',$this->code);
$sFieldName=$this->sid->sid.'X'.$this->question->gid.'X'.$this->qid.$temp[0];
$sValue = $temp[1];
}

return array(
'title' => $this->question->title,
Expand Down

3 comments on commit b3ef63e

@Shnoulle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How we do it before ?

@TonisOrmisson
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Shnoulle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lack of Y.

And, maybe it's better to return null (and not 0) if fieldName(question type) is invalid. Add a test here :

foreach ($aQuotaColumns as $sColumn=>$aValue)
: else request is broken.

There are surely some possibility to update question type after set a quota for it.

Please sign in to comment.