Skip to content

Commit

Permalink
fixed bug: survey could not be created
Browse files Browse the repository at this point in the history
  • Loading branch information
SDClowen committed May 16, 2024
1 parent 0ea2849 commit b86898e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 3 additions & 3 deletions app/controllers/surveys.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ public function apply(int $id = 0)
$data["photo"] = $post->photo;

if ($id == 0) {
$post->userId = User::id();
$post->slug = $randomString(5);
$data["userId"] = User::id();
$data["slug"] = $randomString(5);
$result = $this->db->from("surveys")->insert($data);
} else
$result = $this->db->from("surveys")->where("id", "=", $id)->update($data);
$result = $this->db->from("surveys")->where("id", value: $id)->update($data);

if ($result)
if($id > 0)
Expand Down
6 changes: 1 addition & 5 deletions public/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ $(function () {
slug,
answers = [],
isHorizontal = false,
isRequired = true,
isRequired = false,
conditions = []
) {
var generatedAnswers = "";
Expand Down Expand Up @@ -337,8 +337,6 @@ $(function () {

$this = $(e.currentTarget)
$condition = $this.data("condition");
if($condition == "none")
return;

const type = $this.attr("type")
if(type == "radio")
Expand All @@ -349,8 +347,6 @@ $(function () {
return

$inputCondition = $(inputElement).data("condition");
if($inputCondition == "none")
return;

const conditionDiv = $(`[data-slug='${$inputCondition}']`);
conditionDiv.find("input").prop('checked',false);
Expand Down

0 comments on commit b86898e

Please sign in to comment.