-
Notifications
You must be signed in to change notification settings - Fork 49
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
Assessments #34
Merged
Merged
Assessments #34
Changes from 1 commit
Commits
Show all changes
69 commits
Select commit
Hold shift + click to select a range
a87b621
Added Question and Assessment
sreycodes 971641d
Added functionality for grading
sreycodes 5ca0341
Added assessments functionality
sreycodes f2a81cc
Fixed typo
sreycodes 948abc7
Restructured assessments
sreycodes b030281
Added assessments context
20a25a5
Added controllers
ed5ca63
Delete duplicate file
sreycodes 4319fc9
Changes to suit convention
b865a25
Fixed stuff
sreycodes b15aba4
Ran mix commands
sreycodes a185c5e
Small fixes
16df491
Fix changes
b6e06cd
Removed role validation
21168b9
Removed all compile time errors
sreycodes 1d3de81
Fixed consistency issues
sreycodes f6c265d
Refactored
sreycodes 7520e5b
Conversion to spaces
sreycodes e9d1e57
Merge branch 'master' into assessments
sreycodes 70b9bcf
More functionality for questions
sreycodes 695b99e
Merge branch 'assessments' of https://github.com/source-academy/cadet…
sreycodes d315083
Adding tests
sreycodes 9b99754
Refactored
sreycodes 94379c0
Added few tests for missions
sreycodes c8b5fcc
Few more tests to go
sreycodes 7363ed8
Merge branch 'master' into assessments
sreycodes 51a4f6a
Added more tests
sreycodes eca4d22
Delete useless migration
sreycodes 6b6fe5e
Delete useless migration 2
sreycodes 13e1352
Added submission test
sreycodes f739667
Merge branch 'assessments' of https://github.com/source-academy/cadet…
sreycodes f0ce3a7
Added question tests and switched controllers to new branch
sreycodes 891879d
Added answers test
sreycodes 19ea6a9
Remove unneccesary stuff
sreycodes ebcf903
Formatting
sreycodes 2a50ca2
Fixed compile error
sreycodes 6e8f098
Make changes according to review
sreycodes 006052f
Fixes
sreycodes 6181b4e
Added tests to question and answer
sreycodes a6a2580
Merge branch 'master' into assessments
indocomsoft 6344375
Merge branch 'master' into assessments
sreycodes 8f27f57
Added question types
sreycodes b6b08a9
Merge branch 'assessments' of https://github.com/source-academy/cadet…
sreycodes ed232c8
Various fixes
indocomsoft 35c7d47
Merge branch 'assessments' of https://github.com/source-academy/cadet…
sreycodes 2f15410
Changes according to question types
sreycodes 21e7139
Assessments context
sreycodes 48ec19d
Fixes
sreycodes 4868540
Merge branch 'master' into assessments
sreycodes 9cd468f
Removed invalid test
sreycodes 157929f
Fix some tests
sreycodes 2ef4900
Merge branch 'master' into assessments
sreycodes 843bfa6
Assessments housecleaning (#51)
tuesmiddt d466842
Merge branch 'master' into assessments
indocomsoft 5f49622
Fix credo
indocomsoft bb91e3d
Remove duplicate blank line
indocomsoft 60e9cb6
Remove pre-commit
indocomsoft 5d7d9f7
Refactor json and rename Mission to Assessment
indocomsoft ef3c47d
Merge branch 'master' into assessments
indocomsoft 9451e3f
Fix submission model
indocomsoft 8518c0f
Use cadet context
indocomsoft 988b205
Fix some json tests
indocomsoft 8c79b7a
Fix tests and logic error
indocomsoft f222fbc
Remove untested method and add one test
indocomsoft c28e0b7
Remove useless import
indocomsoft 8783065
Add test
indocomsoft b6d1bfe
Fix according to code review
indocomsoft a6b45e4
Change to pipeline syntax
indocomsoft 14e5ac3
Reorganise file
indocomsoft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
defmodule CadetWeb.AssessmentController do | ||
use CadetWeb, :controller | ||
|
||
alias Cadet.Assessments | ||
|
||
@tabs_map %{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we have tabs? |
||
"Missions" => :mission, | ||
"Sidequests" => :sidequest, | ||
"Paths" => :path, | ||
"Contests" => :contest, | ||
} | ||
|
||
def index(conn, params) do | ||
active_tab = Map.get(params, "tab", "Missions") | ||
tab_keys = @tabs_map | ||
|> Map.to_list | ||
|> Enum.map(fn {key, _} -> key end) | ||
type = Map.get(@tabs_map, active_tab) | ||
missions = Assessments.all_missions(type) | ||
Poison.encode!(%{"active_tab" => active_tab, "tabs" => tab_keys, "missions" => missions}) | ||
end | ||
|
||
def new(conn, _params) do | ||
Poison.encode!(%{"changeset" => Assessments.build_mission(%{})) | ||
end | ||
|
||
def show(conn, %{"id" => id}) do | ||
mission = Assessments.get_mission_and_questions(id) | ||
question_changeset = Assessments.build_question(%{}) | ||
Poison.encode!(%{mission: mission, question_changeset: question_changeset}) | ||
end | ||
|
||
def edit(conn, %{"id" => id}) do | ||
Poison.encode!(%{"changeset" => Assessments.change_mission(id, %{})) | ||
end | ||
|
||
def create(conn, %{"mission" => params}) do | ||
Assessments.create_mission(params) | ||
end | ||
|
||
def update(conn, %{"id" => id, "mission" => params}) do | ||
Assessments.update_mission(id, params) | ||
end | ||
|
||
def publish(conn, %{"mission_id" => id}) do | ||
Assessments.publish_assessment(id) | ||
end | ||
|
||
def submissions(conn, %{"mission_id" => id}) do | ||
mission = Assessments.get_mission(id) | ||
submissions = Assessments.submissions_of_assessment(mission) | ||
not_attempted = Assessments.students_not_attempted(mission) | ||
Poison.encode!(%{"mission" => mission, "submissions" => submissions, "not_attempted" => not_attempted}) | ||
end | ||
|
||
def unsubmit(conn, %{"mission_id" => mid, "id" => id}) do | ||
Assessments.unsubmit_submission(id) do | ||
end | ||
|
||
def edit_grade(conn, %{ | ||
"mission_id" => mission_id, | ||
"id" => submission_id | ||
}) do | ||
submission = Assessments.get_submission(submission_id) | ||
changeset = Assessments.build_grading(submission) | ||
Poison.encode!(%{"changeset" => changeset}) | ||
end | ||
|
||
def update_grade(conn, %{ | ||
"mission_id" => mid, | ||
"id" => id, | ||
"submission" => params | ||
}) do | ||
grader = conn.assigns.current_user | ||
Assessments.update_grading(id, params, grader) do | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
defmodule CadetWeb.QuestionController do | ||
use CadetWeb, :controller | ||
|
||
alias Cadet.Assessments | ||
|
||
def create(conn, %{"mission_id" => mission_id, "question" => params}) do | ||
type = Map.get(params, "problem_type") | ||
Assessments.create_question(params, type, mission_id) do | ||
end | ||
|
||
def edit(conn, %{"mission_id" => mission_id, "id" => id} = params) do | ||
tab = params["tab"] || "Content" | ||
question = Assessments.get_question(id) | ||
mission = Assessments.get_mission(mission_id) | ||
changeset = Assessments.change_question(question, %{}) | ||
params = Map.merge(%{ | ||
tab: tab, | ||
mission: mission, | ||
question: question, | ||
changeset: changeset | ||
}) | ||
end | ||
|
||
def update(conn, params) do | ||
mission_id = params["mission_id"] | ||
Assessments.update_question(params["id"], params["question"]) | ||
end | ||
|
||
def delete(conn, %{"mission_id" => mission_id, "id" => id}) do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unclosed def |
||
Assessments.delete_question(id) | ||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please write swagger specification so I can review your code better :)