ali před 2 roky
rodič
revize
297b1e0c5d

+ 1 - 1
src/api/models/Question.js

@@ -4,7 +4,7 @@ import { Question, QuestionList } from 'src/models/Question.js'
 
 export default class QuestionAPI extends APIRepository {
   constructor() {
-    super('questions', appApi)
+    super('questions', appApi, '/lma/questions', Question, '/lma/questions')
     this.APIAdresses = {
       base: '/lma/questions',
       byId: (id) => '/lma/questions/' + id

+ 21 - 1
src/api/models/Test.js

@@ -7,7 +7,9 @@ export default class TestAPI extends APIRepository {
     super('tests', appApi)
     this.APIAdresses = {
       base: '/lma/tests',
-      byId: (id) => '/lma/tests/' + id
+      byId: (id) => '/lma/tests/' + id,
+      testQuestionById: (id) => '/lma/test_questions/' + id,
+      appendQuestion: (id) => '/lma/tests/' + id + '/append_question'
     }
     this.CacheList = {
       base: this.name + this.APIAdresses.base
@@ -87,4 +89,22 @@ export default class TestAPI extends APIRepository {
       }
     })
   }
+
+  editTestQuestion (data) {
+    return this.sendRequest({
+      apiMethod: 'put',
+      api: this.api,
+      request: this.APIAdresses.testQuestionById(data.id),
+      data: {
+        mark: data.mark,
+        is_extra_mark: data.is_extra_mark
+      },
+      resolveCallback: () => {
+        return null
+      },
+      rejectCallback: (error) => {
+        return error
+      }
+    })
+  }
 }

+ 101 - 0
src/components/FormBuilderCustumComponents/QuestionsCreateAndAppend/CreateQuestionForm.vue

@@ -0,0 +1,101 @@
+<template>
+  <div class="CreateQuestionForm">
+    <entity-edit v-if="mounted"
+                 ref="entityEdit"
+                 v-model:value="inputs"
+                 title="ایجاد سوال جدید"
+                 :api="api"
+                 :loaded-data="loadedData"
+                 :entity-id-key="entityIdKey"
+                 :entity-param-key="entityParamKey"
+                 :show-route-name="showRouteName"
+                 :show-close-button="false"
+                 :show-edit-button="false"
+                 :show-expand-button="false"
+                 :show-save-button="false"
+                 :show-reload-button="false"
+                 :redirect-after-edit="false"
+                 :after-load-input-data="afterLoadInputData">
+      <template #toolbar>
+        <q-btn v-close-popup
+               icon="close"
+               flat />
+      </template>
+    </entity-edit>
+  </div>
+</template>
+
+<script>
+import { shallowRef } from 'vue'
+import { EntityEdit } from 'quasar-crud'
+import { Question } from 'src/models/Question.js'
+import { APIGateway } from 'src/api/APIGateway.js'
+import BtnControl from 'src/components/Control/btn.vue'
+import { FormBuilderAssist } from 'quasar-form-builder'
+
+const BtnControlComp = shallowRef(BtnControl)
+
+export default {
+  name: 'CreateQuestionForm',
+  components: {
+    EntityEdit
+  },
+  props: {
+    testId: {
+      type: Number,
+      default: null
+    }
+  },
+  emits: ['onQuestionCreated'],
+  data () {
+    return {
+      mounted: false,
+      entityLoading: true,
+      api: APIGateway.test.APIAdresses.appendQuestion(this.testId),
+      entityIdKey: 'id',
+      entityParamKey: 'id',
+      showRouteName: 'Admin.Unit.Questions.Show',
+      loadedData: new Question(),
+      inputs: [
+        { type: 'input', name: 'text', responseKey: 'text', label: 'سوال', placeholder: ' ', col: 'col-12' },
+        { type: 'inputEditor', name: 'correct_answer', responseKey: 'correct_answer', label: 'پاسخ', placeholder: ' ', col: 'col-12' },
+        { type: 'input', name: 'mark', responseKey: 'mark', label: 'بارم پیشنهادی سوال', placeholder: ' ', col: 'col-md-3 col-12' },
+        { type: 'select', name: 'level', responseKey: 'level', label: 'سطح سوال', placeholder: ' ', options: (new Question()).levelEnums, col: 'col-md-3 col-12' },
+        { type: BtnControlComp, name: 'btn', label: 'ذخیره سوال', placeholder: ' ', atClick: () => {}, col: 'col-12 flex justify-end' },
+        { type: 'hidden', name: 'type', responseKey: 'type', value: 'QUESTION_BANK' }
+      ]
+    }
+  },
+  mounted() {
+    this.setActionBtn()
+    this.mounted = true
+  },
+  methods: {
+    setActionBtn () {
+      FormBuilderAssist.setAttributeByName(this.inputs, 'btn', 'atClick', this.edit)
+    },
+    afterLoadInputData () {
+      this.entityLoading = false
+    },
+    edit() {
+      this.entityLoading = true
+      this.$refs.entityEdit.editEntity(false)
+        .then((response) => {
+          this.$emit('onQuestionCreated', response.data)
+          this.entityLoading = false
+        })
+        .catch(() => {
+          this.entityLoading = false
+        })
+    }
+  }
+}
+</script>
+
+<style scoped lang="scss">
+.CreateQuestionForm {
+  .entity-edit {
+    height: 100vh;
+  }
+}
+</style>

+ 99 - 0
src/components/FormBuilderCustumComponents/QuestionsCreateAndAppend/EditQuestionForm.vue

@@ -0,0 +1,99 @@
+<template>
+  <div class="EditQuestionForm">
+    <entity-edit v-if="mounted"
+                 ref="entityEdit"
+                 v-model:value="inputs"
+                 title="ویرایش سوال"
+                 :api="api"
+                 :entity-id-key="entityIdKey"
+                 :entity-param-key="entityParamKey"
+                 :show-route-name="showRouteName"
+                 :show-close-button="false"
+                 :show-edit-button="false"
+                 :show-expand-button="false"
+                 :show-save-button="false"
+                 :show-reload-button="false"
+                 :redirect-after-edit="false"
+                 :after-load-input-data="afterLoadInputData">
+      <template #toolbar>
+        <q-btn v-close-popup
+               icon="close"
+               flat />
+      </template>
+    </entity-edit>
+  </div>
+</template>
+
+<script>
+import { shallowRef } from 'vue'
+import { EntityEdit } from 'quasar-crud'
+import { Question } from 'src/models/Question.js'
+import { APIGateway } from 'src/api/APIGateway.js'
+import BtnControl from 'src/components/Control/btn.vue'
+import { FormBuilderAssist } from 'quasar-form-builder'
+
+const BtnControlComp = shallowRef(BtnControl)
+
+export default {
+  name: 'EditQuestionForm',
+  components: {
+    EntityEdit
+  },
+  props: {
+    questionId: {
+      type: Number,
+      default: null
+    }
+  },
+  emits: ['onQuestionEdited'],
+  data () {
+    return {
+      mounted: false,
+      entityLoading: true,
+      api: APIGateway.question.APIAdresses.byId(this.questionId),
+      entityIdKey: 'id',
+      entityParamKey: 'id',
+      showRouteName: 'Admin.Unit.Questions.Show',
+      inputs: [
+        { type: 'input', name: 'text', responseKey: 'text', label: 'سوال', placeholder: ' ', col: 'col-12' },
+        { type: 'inputEditor', name: 'correct_answer', responseKey: 'correct_answer', label: 'پاسخ', placeholder: ' ', col: 'col-12' },
+        { type: 'input', name: 'mark', responseKey: 'mark', label: 'بارم پیشنهادی سوال', placeholder: ' ', col: 'col-md-3 col-12' },
+        { type: 'select', name: 'level', responseKey: 'level', label: 'سطح سوال', placeholder: ' ', options: (new Question()).levelEnums, col: 'col-md-3 col-12' },
+        { type: BtnControlComp, name: 'btn', label: 'ذخیره سوال', placeholder: ' ', atClick: () => {}, col: 'col-12 flex justify-end' },
+        { type: 'hidden', name: 'type', responseKey: 'type', value: 'QUESTION_BANK' }
+      ]
+    }
+  },
+  mounted() {
+    this.setActionBtn()
+    this.mounted = true
+  },
+  methods: {
+    setActionBtn () {
+      FormBuilderAssist.setAttributeByName(this.inputs, 'btn', 'atClick', this.edit)
+    },
+    afterLoadInputData () {
+      this.entityLoading = false
+    },
+    edit() {
+      this.entityLoading = true
+      this.$refs.entityEdit.editEntity(false)
+        .then((response) => {
+          this.$emit('onQuestionEdited', response.data)
+          this.entityLoading = false
+        })
+        .catch(() => {
+          this.entityLoading = false
+        })
+    }
+  }
+}
+</script>
+
+<style scoped lang="scss">
+.EditQuestionForm {
+  .entity-edit {
+    height: 100vh;
+  }
+}
+</style>

+ 487 - 0
src/components/FormBuilderCustumComponents/QuestionsCreateAndAppend/QuestionsCreateAndAppend.vue

@@ -0,0 +1,487 @@
+<template>
+  <div class="ContentsSelector q-mt-md">
+    <q-table title="سوالات"
+             :rows="testQuestionList"
+             :columns="table.columns"
+             row-key="name">
+      <template #top>
+        <q-banner class="full-width">
+          <div class="flex justify-between">
+            <span>
+              انتخاب سوال
+            </span>
+            <q-btn color="primary"
+                   class="q-mr-md"
+                   outline
+                   :loading="test.loading"
+                   @click="openDialogCreateNewQuestion">
+              سوال جدید
+            </q-btn>
+          </div>
+        </q-banner>
+      </template>
+      <template #bottom />
+      <template #body-cell-number="props">
+        <q-td>
+          {{ props.rowIndex + 1 }}
+        </q-td>
+      </template>
+      <template #body-cell-mark="props">
+        <q-td auto-width>
+          <q-input v-model="props.row.mark"
+                   style="width: 80px;"
+                   :loading="test.loading" />
+        </q-td>
+      </template>
+      <template #body-cell-is_extra_mark="props">
+        <q-td auto-width>
+          <q-toggle v-model="props.row.is_extra_mark"
+                    :loading="test.loading" />
+        </q-td>
+      </template>
+      <template #body-cell-action="props">
+        <q-td auto-width>
+          <q-btn color="primary"
+                 class="q-mr-md"
+                 size="sm"
+                 outline
+                 :loading="test.loading"
+                 @click="openDialogEditQuestion(props.row.question_info.id)">
+            ویرایش سوال
+          </q-btn>
+          <q-btn color="primary"
+                 class="q-mr-lg"
+                 size="sm"
+                 outline
+                 @click="editTestQuestion(props.row)">
+            ویرایش نمره و حالت امتیازی سوال
+          </q-btn>
+          <q-btn color="red"
+                 class="q-mr-md"
+                 size="sm"
+                 :loading="test.loading"
+                 @click="deleteQuestion(props.row.question_info.id)">
+            حذف سوال
+          </q-btn>
+        </q-td>
+      </template>
+    </q-table>
+    <div class="q-mt-lg">
+      <template v-if="questionType === 'QUESTION_BANK'">
+        <div class="row">
+          <div class="col-md-4 col-12">
+            تعداد سوالات اجباری:
+            {{ countOfForceQuestions }}
+          </div>
+          <div class="col-md-4 col-12">
+            مجموع بارم‌ها:
+            {{ sumOfTotalMarks }}
+          </div>
+          <div class="col-12" />
+          <div class="col-md-4 col-12">
+            تعداد سوالات اختیاری:
+            {{ countOfExtraQuestions }}
+          </div>
+          <div class="col-md-4 col-12">
+            مجموع بارم سوالات اختیاری:
+            {{ sumOfExtraMarks }}
+          </div>
+        </div>
+      </template>
+      <template v-else-if="questionType === 'EVENT'">
+        <div class="row">
+          <div class="col-md-4 col-12">
+            تعداد سوالات انتخاب شده:
+            {{ localValue.length }}
+          </div>
+        </div>
+      </template>
+    </div>
+    <q-dialog v-model="editQuestionDialog"
+              maximized
+              transition-show="slide-up"
+              transition-hide="slide-down">
+      <edit-question-form :question-id="selectedQuestionIdForEdit"
+                          @onQuestionEdited="onQuestionEdited" />
+    </q-dialog>
+    <q-dialog v-model="createNewQuestionDialog"
+              maximized
+              transition-show="slide-up"
+              transition-hide="slide-down">
+      <create-question-form :test-id="testId"
+                            @onQuestionCreated="onQuestionCreated" />
+    </q-dialog>
+  </div>
+</template>
+
+<script>
+import { APIGateway } from 'src/api/APIGateway.js'
+import { FormBuilderAssist } from 'quasar-form-builder'
+import EditQuestionForm from './EditQuestionForm.vue'
+import CreateQuestionForm from './CreateQuestionForm.vue'
+import NormalizeNumber from 'src/assets/js/NormalizeNumber.js'
+import { Test } from 'src/models/Test.js'
+import { Question, QuestionList } from 'src/models/Question.js'
+import { SessionTemplateList } from 'src/models/SessionTemplate.js'
+
+export default {
+  name: 'QuestionsSelector',
+  components: {
+    EditQuestionForm,
+    CreateQuestionForm
+  },
+  props: {
+    value: {
+      default: () => [],
+      type: [Array, String, Number, Boolean]
+    },
+    readonly: {
+      default: false,
+      type: Boolean
+    },
+    showPageLink: {
+      default: true,
+      type: Boolean
+    },
+    showDownloadLink: {
+      default: false,
+      type: Boolean
+    },
+    questionType: {
+      default: 'QUESTION_BANK',
+      type: String
+    },
+    testId: {
+      default: null,
+      type: [Number, String, Boolean]
+    },
+    unitId: {
+      default: null,
+      type: [Number, String, Boolean]
+    }
+  },
+  emits: ['update:value'],
+  data () {
+    return {
+      mounted: false,
+      selectedQuestionIdForEdit: null,
+      editQuestionDialog: false,
+      createNewQuestionDialog: false,
+      selectedSession: null,
+      test: new Test(),
+      testQuestionList: [],
+      sessions: new SessionTemplateList(),
+      sessionQuestions: new QuestionList(),
+      loadedQuestions: {},
+
+      api: APIGateway.question.APIAdresses.base,
+      tableKeys: {
+        data: 'results',
+        total: 'count',
+        currentPage: 'current',
+        perPage: 'per_page',
+        pageKey: 'page'
+      },
+      inputs: [
+        { type: 'hidden', name: 'type', value: this.questionType },
+        { type: 'hidden', name: 'session_template_questions__session_template', value: null }
+        // { type: 'hidden', name: 'session_template_questions__session_template__unit', value: this.unitId }
+      ],
+      table: {
+        columns: []
+      }
+    }
+  },
+  computed: {
+    selectedSessionTitle () {
+      if (!this.selectedSession?.title) {
+        return ''
+      }
+      return this.selectedSession?.title
+    },
+    countOfForceQuestions () {
+      return this.testQuestionList.filter(item => !item.is_extra_mark).length
+    },
+    countOfExtraQuestions () {
+      return this.testQuestionList.filter(item => item.is_extra_mark).length
+    },
+    sumOfExtraMarks () {
+      let sum = 0
+      this.testQuestionList.filter(item => item.is_extra_mark).forEach(item => {
+        sum += parseInt(NormalizeNumber.toEnglish(item.mark.toString()))
+      })
+
+      return sum
+    },
+    sumOfTotalMarks () {
+      let sum = 0
+      this.testQuestionList.forEach(item => {
+        sum += parseInt(NormalizeNumber.toEnglish(item.mark.toString()))
+      })
+
+      return sum
+    },
+    localValue: {
+      get () {
+        return this.value
+      },
+      set (newValue) {
+        this.$emit('update:value', newValue)
+      }
+    },
+    sessionOptions () {
+      return this.sessions.list.map(item => {
+        return {
+          value: item,
+          label: item.title
+        }
+      })
+    },
+    selectedSessionId () {
+      if (!this.selectedSession) {
+        return null
+      }
+      return this.selectedSession.id
+    }
+  },
+  watch: {
+    value () {
+      this.reFreshTestQuestionList()
+    }
+  },
+  created () {
+    if (this.questionType === 'QUESTION_BANK') {
+      this.table.columns = [
+        {
+          name: 'number',
+          required: true,
+          label: 'شماره',
+          align: 'left',
+          field: () => ''
+        },
+        {
+          name: 'id',
+          required: true,
+          label: 'شناسه',
+          align: 'left',
+          field: row => row.question_info.id
+        },
+        {
+          name: 'text',
+          required: true,
+          label: 'عنوان سوال',
+          align: 'left',
+          field: row => row.question_info.text
+        },
+        {
+          name: 'level',
+          required: true,
+          label: 'سطح سوال',
+          align: 'left',
+          field: row => new Question(row.question_info).level_info.label
+        },
+        {
+          name: 'mark',
+          required: true,
+          label: 'بارم',
+          align: 'left',
+          field: row => row.question_info.mark
+        },
+        {
+          name: 'is_extra_mark',
+          required: true,
+          label: 'سوال امتیازی',
+          align: 'left',
+          field: row => ''
+        },
+        {
+          name: 'action',
+          required: true,
+          label: 'عملیات',
+          align: 'left',
+          field: row => ''
+        }
+      ]
+    } else if (this.questionType === 'EVENT') {
+      this.table.columns = [
+        {
+          name: 'number',
+          required: true,
+          label: 'شماره',
+          align: 'left',
+          field: () => ''
+        },
+        {
+          name: 'id',
+          required: true,
+          label: 'شناسه',
+          align: 'left',
+          field: row => row.id
+        },
+        {
+          name: 'text',
+          required: true,
+          label: 'عنوان سوال',
+          align: 'left',
+          field: row => row.text
+        },
+        {
+          name: 'action',
+          required: true,
+          label: 'عملیات',
+          align: 'left',
+          field: row => ''
+        }
+      ]
+    }
+    this.reFreshTestQuestionList()
+  },
+  mounted () {
+    if (this.questionType === 'QUESTION_BANK') {
+      this.getSessions()
+    } else {
+      this.mounted = true
+    }
+  },
+  methods: {
+    onQuestionEdited () {
+      this.editQuestionDialog = false
+      this.refreshTestQuestions()
+    },
+    onQuestionCreated () {
+      this.createNewQuestionDialog = false
+      this.refreshTestQuestions()
+    },
+    openDialogEditQuestion (questionId) {
+      this.selectedQuestionIdForEdit = questionId
+      this.editQuestionDialog = true
+    },
+    openDialogCreateNewQuestion () {
+      this.createNewQuestionDialog = true
+    },
+    getShowQuestionRoute (questionId, unitId, selectedSessionId) {
+      if (this.questionType === 'QUESTION_BANK') {
+        return { name: 'Admin.Unit.Questions.Show', params: { unit_id: unitId, session_template_id: selectedSessionId, id: questionId } }
+      } else if (this.questionType === 'EVENT') {
+        return { name: 'Admin.Event.TestSet.Questions.Show', params: { question_id: questionId } }
+      }
+    },
+    emitValues () {
+
+    },
+    reFreshTestQuestionList () {
+      if (!Array.isArray(this.localValue)) {
+        return
+      }
+      this.testQuestionList = JSON.parse(JSON.stringify(this.localValue))
+    },
+    editTestQuestion (testQuestion) {
+      this.test.loading = true
+      APIGateway.test.editTestQuestion(testQuestion)
+        .then(() => {
+          this.test.loading = false
+          this.refreshTestQuestions()
+        })
+        .catch(() => {
+          this.test.loading = false
+        })
+    },
+    deleteQuestion (questionId) {
+      this.$q.dialog({
+        title: 'حذف سوال',
+        message: 'آیا از حذف سوال اطمینان دارید؟',
+        cancel: true,
+        persistent: true
+      }).onOk(() => {
+        this.test.loading = true
+        APIGateway.question.delete({ data: { id: questionId } })
+          .then(() => {
+            this.test.loading = false
+            this.refreshTestQuestions()
+          })
+          .catch(() => {
+            this.test.loading = false
+          })
+      }).onCancel(() => {})
+    },
+    refreshTestQuestions () {
+      this.test.loading = true
+      APIGateway.test.get(this.testId)
+        .then((test) => {
+          this.test.loading = false
+          this.localValue = test.inputData.test_questions_info
+          this.reFreshTestQuestionList()
+        })
+        .catch(() => {
+          this.test.loading = false
+        })
+    },
+    filterQuestionList () {
+      if (this.selectedSessionId) {
+        FormBuilderAssist.setAttributeByName(this.inputs, 'session_template_questions__session_template', 'value', this.selectedSessionId)
+      }
+
+      this.$refs.entityIndexQuestions.search()
+    },
+    getSessions () {
+      this.sessions.loading = true
+      APIGateway.sessionTemplate.index({ unit: this.unitId || null, per_page: 999999 })
+        .then((data) => {
+          this.sessions = new SessionTemplateList(data.list)
+          if (this.sessions.list.length > 0) {
+            // this.selectedSession = this.sessions.list[0]
+          }
+          this.filterQuestionList()
+          this.sessions.loading = false
+          this.mounted = true
+        })
+        .catch(() => {
+          this.sessions.loading = false
+          this.mounted = true
+        })
+    },
+    getSessionQuestions () {
+      this.sessions.loading = true
+      APIGateway.sessionTemplate.index({ unit: this.unitId || null, per_page: 999999 })
+        .then((data) => {
+          this.sessions = new SessionTemplateList(data.list)
+          if (this.sessionOptions.length > 0) {
+            this.selectedSession = this.sessionOptions[0]
+          }
+          this.sessions.loading = false
+        })
+        .catch(() => {
+          this.sessions.loading = false
+        })
+    },
+    onChangeQuestionListPage (response) {
+      this.updateloadedQuestionsByArray(response.data.results)
+    },
+    updateloadedQuestionsByArray (array, allSelected = false) {
+      if (!array || !Array.isArray(array)) {
+        return
+      }
+      array.forEach(item => {
+        const questionId = item.question || item.id
+        const mark = item.mark || 0
+        const isExtraMark = item.is_extra_mark || false
+        const selected = allSelected || this.value.includes(questionId)
+        const target = this.loadedQuestions[questionId]
+        if (!target) {
+          this.loadedQuestions[questionId] = {
+            question: questionId,
+            mark,
+            is_extra_mark: isExtraMark,
+            selected
+          }
+        }
+      })
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.ContentsSelector {
+}
+</style>

+ 3 - 4
src/components/Widgets/Test/AdminTestShow/AdminTestShow.vue

@@ -42,12 +42,12 @@ import { FormBuilderAssist } from 'quasar-form-builder'
 import BtnControl from 'src/components/Control/btn.vue'
 import { UnitCategory } from 'src/models/UnitCategory.js'
 import Breadcrumbs from 'src/components/Widgets/Breadcrumbs/Breadcrumbs.vue'
-import QuestionsSelector from 'src/components/FormBuilderCustumComponents/QuestionsSelector/QuestionsSelector.vue'
+import QuestionsCreateAndAppend from 'src/components/FormBuilderCustumComponents/QuestionsCreateAndAppend/QuestionsCreateAndAppend.vue'
 import UsersOfTestSelector from 'src/components/FormBuilderCustumComponents/UsersOfTestSelector/UsersOfTestSelector.vue'
 
 const BtnControlComp = shallowRef(BtnControl)
-const QuestionsSelectorComp = shallowRef(QuestionsSelector)
 const UsersOfTestSelectorComp = shallowRef(UsersOfTestSelector)
+const QuestionsCreateAndAppendComp = shallowRef(QuestionsCreateAndAppend)
 
 export default {
   name: 'AdminTestShow',
@@ -74,7 +74,7 @@ export default {
         { type: 'select', name: 'level', responseKey: 'level', label: 'سطح آزمون', placeholder: ' ', options: (new Test()).levelEnums, col: 'col-md-3 col-12' },
         { type: 'hidden', name: 'test_set', responseKey: 'test_set', value: this.$route.params.test_set_id },
         { type: 'hidden', name: 'classroom', responseKey: 'classroom', value: this.$route.params.classroom_id },
-        { type: QuestionsSelectorComp, name: 'test_questions', responseKey: 'test_questions', unitId: false, questionType: 'QUESTION_BANK', col: 'col-md-12 col-12' },
+        { type: QuestionsCreateAndAppendComp, name: 'test_questions', responseKey: 'test_questions_info', testId: this.$route.params.id, questionType: 'QUESTION_BANK', ignoreValue: true, col: 'col-md-12 col-12' },
         { type: UsersOfTestSelectorComp, name: 'examinees', responseKey: 'examinees', classroomId: this.$route.params.classroom_id, col: 'col-12' },
         { type: BtnControlComp, name: 'btn', responseKey: 'btn', label: 'تعیین جزییات', placeholder: ' ', atClick: () => {}, col: 'col-12 flex justify-end' }
       ],
@@ -151,7 +151,6 @@ export default {
           this.classroom = new Classroom(classroom)
           this.classroom.loading = false
           this.updateBreadcrumbs()
-          FormBuilderAssist.setAttributeByName(this.classroomInputs, 'test_questions', 'unitId', this.classroom.unit)
         })
         .catch(() => {
           this.classroom.loading = false