Skip to content

Commit

Permalink
fix: CDNにキャッシュされるケースがあるため修正
Browse files Browse the repository at this point in the history
  • Loading branch information
s-nakajima committed Mar 18, 2024
1 parent 2bed6aa commit 1f644f7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
16 changes: 10 additions & 6 deletions Controller/RegistrationAnswersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* @property RegistrationAnswer $RegistrationAnswer
* @property RegistrationsOwnAnswerComponent $RegistrationOwnAnswer
* @property RegistrationAnswerSummary $RegistrationAnswerSummary
*
*
* @SuppressWarnings(PHPMD.ExcessiveClassComplexity)
*/
class RegistrationAnswersController extends RegistrationsAppController {
Expand Down Expand Up @@ -390,11 +390,15 @@ public function view() {
}
}
if (! ($this->request->is('post') && $nextPageSeq == $postPageSeq)) {
$summary = $this->RegistrationsOwnAnswer->getProgressiveSummaryOfThisUser(
$registrationKey);
$setAnswers = $this->RegistrationAnswer->getProgressiveAnswerOfThisSummary(
$registration,
$summary);
if (empty($this->request->params['requested'])) {
$summary = $this->RegistrationsOwnAnswer->getProgressiveSummaryOfThisUser(
$registrationKey);
$setAnswers = $this->RegistrationAnswer->getProgressiveAnswerOfThisSummary(
$registration,
$summary);
} else {
$setAnswers = [];
}
$this->set('answers', $setAnswers);
$this->request->data['RegistrationAnswer'] = $setAnswers;

Expand Down
7 changes: 7 additions & 0 deletions Model/RegistrationAnswer.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,13 @@ public function saveAnswer($data, $registration, $summary) {
if (! $targetQuestion) {
throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
}

//HACK: 作りが悪いため、DELETE->INSERTで既存データを初期化してから登録する
$this->deleteAll([
$this->alias . '.registration_answer_summary_id' => $summaryId,
$this->alias . '.registration_question_key' => $targetQuestionKey,
], false);

// データ保存
// Matrixタイプの場合はanswerが配列になっているがsaveでかまわない
// saveMany中で1回しかValidateしなくてよい関数のためのフラグ
Expand Down

0 comments on commit 1f644f7

Please sign in to comment.