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

feat: schemas,controllers for the practice section #4967

Open
wants to merge 53 commits into
base: circuitverse-practice-section
Choose a base branch
from

Conversation

jaydip1235
Copy link
Contributor

@jaydip1235 jaydip1235 commented Jun 2, 2024

Fixes #4966

Added scehams , routes and controller for question management system and tested

app/models/category.rb Outdated Show resolved Hide resolved
app/models/category.rb Show resolved Hide resolved
app/models/difficulty_level.rb Outdated Show resolved Hide resolved
app/models/difficulty_level.rb Show resolved Hide resolved
app/models/question.rb Show resolved Hide resolved
app/models/user.rb Outdated Show resolved Hide resolved
app/models/user.rb Outdated Show resolved Hide resolved
app/helpers/api/v1/categories_helper.rb Outdated Show resolved Hide resolved
app/helpers/api/v1/questions_helper.rb Show resolved Hide resolved
app/controllers/api/v1/categories_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/categories_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/categories_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/categories_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/categories_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/categories_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/categories_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/categories_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/categories_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/categories_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/categories_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/categories_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/categories_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/categories_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/difficulty_levels_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/difficulty_levels_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/difficulty_levels_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/difficulty_levels_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/difficulty_levels_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/difficulty_levels_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/difficulty_levels_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/difficulty_levels_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/difficulty_levels_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/difficulty_levels_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/questions_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/questions_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/questions_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/questions_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/questions_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/questions_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/questions_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/questions_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/questions_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/questions_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/questions_controller.rb Outdated Show resolved Hide resolved
spec/factories/categories.rb Show resolved Hide resolved
spec/factories/difficulty_levels.rb Show resolved Hide resolved
spec/factories/questions.rb Show resolved Hide resolved
spec/helpers/api/v1/categories_helper_spec.rb Outdated Show resolved Hide resolved
spec/helpers/api/v1/categories_helper_spec.rb Outdated Show resolved Hide resolved
spec/helpers/api/v1/difficulty_levels_helper_spec.rb Outdated Show resolved Hide resolved
spec/helpers/api/v1/difficulty_levels_helper_spec.rb Outdated Show resolved Hide resolved
spec/helpers/api/v1/questions_helper_spec.rb Outdated Show resolved Hide resolved
spec/helpers/api/v1/questions_helper_spec.rb Outdated Show resolved Hide resolved
spec/models/category_spec.rb Outdated Show resolved Hide resolved
spec/models/category_spec.rb Outdated Show resolved Hide resolved
spec/models/difficulty_level_spec.rb Outdated Show resolved Hide resolved
spec/models/difficulty_level_spec.rb Outdated Show resolved Hide resolved
spec/models/question_spec.rb Outdated Show resolved Hide resolved
spec/models/question_spec.rb Outdated Show resolved Hide resolved
app/models/category.rb Show resolved Hide resolved
spec/requests/api/v1/categories_spec.rb Outdated Show resolved Hide resolved
spec/requests/api/v1/categories_spec.rb Outdated Show resolved Hide resolved
spec/requests/api/v1/difficulty_levels_spec.rb Outdated Show resolved Hide resolved
spec/requests/api/v1/difficulty_levels_spec.rb Outdated Show resolved Hide resolved
spec/requests/api/v1/questions_spec.rb Outdated Show resolved Hide resolved
spec/requests/api/v1/questions_spec.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/categories_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/categories_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/categories_controller.rb Outdated Show resolved Hide resolved
app/controllers/api/v1/categories_controller.rb Outdated Show resolved Hide resolved
Copy link

codeclimate bot commented Jun 21, 2024

Code Climate has analyzed commit 5a08114 and detected 0 issues on this pull request.

View more on Code Climate.

@jaydip1235 jaydip1235 changed the base branch from master to circuitverse-practice-section June 21, 2024 06:02
@jaydip1235 jaydip1235 marked this pull request as ready for review June 21, 2024 06:03
@@ -0,0 +1,4 @@
# frozen_string_literal: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Difficulty level has been moved to enum. So this will not required anymore.

@@ -0,0 +1,5 @@
# frozen_string_literal: true

class Category < ApplicationRecord
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wil be better to rename the model to QuestionCategory

@@ -0,0 +1,9 @@
# frozen_string_literal: true

class DifficultyLevel < ApplicationRecord
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will be better to rename the model to QuestionDifficultyLevel

@@ -92,7 +92,7 @@

create_table "assignments", force: :cascade do |t|
t.string "name"
t.datetime "deadline", null: false
t.datetime "deadline", precision: nil, null: false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rollback this change, if not required

@@ -451,6 +477,9 @@
t.string "educational_institute"
t.boolean "subscribed", default: true
t.string "locale"
t.jsonb "submission_history", default: [], array: true
t.boolean "public", default: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this added public field required ?


FactoryBot.define do
factory :category do
name { "MyString" }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name { "MyString" }
name { Faker::Lorem.word }

Use faker instead of hard coded value

@@ -0,0 +1,8 @@
# frozen_string_literal: true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the model has been removed and moved to enum, this file may be removed

Comment on lines +4 to +11
factory :question do
heading { "MyString" }
statement { "MyText" }
category { nil }
difficulty_level { nil }
test_data { "" }
circuit_boilerplate { "" }
end
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Faker . Ref- https://github.com/faker-ruby/faker?tab=readme-ov-file#usage

For test_data and circuit_boilerplate, we may put a blank JSON instead of blank string

@@ -0,0 +1 @@
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this file

@tanmoysrt tanmoysrt changed the title feat: created schemas,controllers for the question bank management sy… feat: schemas,controllers for the practice section Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants