Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERM model #22

Closed
alex1897 opened this issue Aug 1, 2022 · 3 comments · Fixed by #24
Closed

ERM model #22

alex1897 opened this issue Aug 1, 2022 · 3 comments · Fixed by #24
Labels
documentation Improvements or additions to documentation

Comments

@alex1897
Copy link
Contributor

alex1897 commented Aug 1, 2022

I checked the ERM and I found some differences:
173225090-8dc96205-1a08-4ed2-8954-1a53bccc7359

Completely missing seems to be the "QuestionTopic" since I did't find how to connect a "Topic" and a "Question". There is also no migration existing for that. What is the need of "Topic"?

Another question I have is the table "topicables" which is not part or the ERM and seems not be used.

@harishdurga harishdurga added the documentation Improvements or additions to documentation label Aug 2, 2022
@harishdurga
Copy link
Owner

@alex1897 Yeah it seems I have to update the diagram and README covering the things you have mentioned. Topic is useful to categorize the content. Consider a topic as Computer Science . So If I attach this topic to some of my questions, a filter can be added to the application where a user can see questions for the Computer Science topic. The same goes for the Quizzes as well. So currently you can attach topics to questions and quizzes.

$topic1 = Topic::factory()->create(['topic' => 'Test Topic One']);
        $topic2 = Topic::factory()->create(['topic' => 'Test Topic Two']);
        $question = Question::factory()->create();
        $question->topics()->attach($topic1);
        $question->topics()->attach($topic2);
$quiz = Quiz::factory()->make()->create([
            'name' => 'Sample Quiz',
            'slug' => 'sample-quiz',
        ]);
        $topic_one = Topic::factory()->make()->create([
            'name' => 'Topic One',
            'slug' => 'topic-one',
        ]);
        $topic_two = Topic::factory()->make()->create([
            'name' => 'Topic Two',
            'slug' => 'topic-two',
        ]);
        $quiz->topics()->attach([$topic_one->id, $topic_two->id]);

@alex1897
Copy link
Contributor Author

alex1897 commented Aug 3, 2022

I forgot that a question is not directly linked to quiz. A categorization with topics makes defiantly sense, especially when building quizzes afterwards, then you could filter by a specific topic. Also, for your planned "Generate Random Quizzes" it is helpful to make use only a specific topic.

However, this is realized with topicables instead of question_topics as in the ERM model, right?

@harishdurga
Copy link
Owner

Yes, that's correct. The diagram needs to be updated. As you already know there is no question_topics table but a topicables table can host the links of topics to questions, and quizzes. If we can create a topicable trait, then this can be extended to other types of models as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants