Skip to content

Commit

Permalink
Change to session from cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
kteraguchi committed Dec 8, 2015
1 parent 7afb29b commit 08c30db
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Controller/Component/QuestionnairesComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ public static function isMatrixInputType($type) {
/**
* 回答済みアンケートリストを取得する
*
* 回答済みデータをルーム毎に保持したほうが良いかも
* 回答済みデータをブロック毎に保持したほうが良いかも
*
* @return Answered Questionnaire keys list
*/
Expand All @@ -638,10 +638,10 @@ public function getOwnAnsweredKeys() {
$this->__ownAnsweredKeys = array();

if (empty(Current::read('User.id'))) {
$cookie = $this->_Collection->load('Cookie');
$keys = $cookie->read('answeredQuestionnaireKeys');
if (isset($keys)) {
$this->__ownAnsweredKeys = explode(',', $keys);
$session = $this->_Collection->load('Session');
$ownAnsweredKeys = $session->read('Questionnaires.ownAnsweredKeys');
if (isset($ownAnsweredKeys)) {
$this->__ownAnsweredKeys = explode(',', $ownAnsweredKeys);
}

return $this->__ownAnsweredKeys;
Expand All @@ -654,15 +654,15 @@ public function getOwnAnsweredKeys() {
'test_status' => QuestionnairesComponent::TEST_ANSWER_STATUS_PEFORM,
'answer_number' => 1
);
$keys = $answerSummary->find(
$ownAnsweredKeys = $answerSummary->find(
'list',
array(
'conditions' => $conditions,
'fields' => array('QuestionnaireAnswerSummary.questionnaire_key'),
'recursive' => -1
)
);
$this->__ownAnsweredKeys = array_values($keys); // idの使用を防ぐ(いらない?)
$this->__ownAnsweredKeys = array_values($ownAnsweredKeys); // idの使用を防ぐ(いらない?)

return $this->__ownAnsweredKeys;
}
Expand Down

0 comments on commit 08c30db

Please sign in to comment.