Skip to content

Commit

Permalink
Nursing fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kreut committed Nov 1, 2022
1 parent 66126a0 commit ebfde49
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,22 @@ class AssignmentQuestionSyncCaseStudyNotesController extends Controller
/**
* @param Assignment $assignment
* @param int $order
* @param AssignmentQuestionCaseStudyNotes $assignmentQuestionCaseStudyNotes
* @param CaseStudyNote $caseStudyNote
* @return array
* @throws Exception
*/
public function index(Assignment $assignment,
int $order,
AssignmentQuestionCaseStudyNotes $assignmentQuestionCaseStudyNotes,
CaseStudyNote $caseStudyNote): array
{
/* $response['type'] = 'error';
$question_id = DB::table('assignment_question')
->where('assignment_id', $assignment->id)
->first(); //just care that it's some question in the assignment
$question = Question::find($question_id);
$authorized = Gate::inspect('index', [$assignmentQuestionCaseStudyNotes, $assignment, $question]);
$response['type'] = 'error';
$authorized = Gate::inspect('view', $assignment);

if (!$authorized->allowed()) {
$response['message'] = $authorized->message();
return $response;
}
*/

try {
$patient_information = DB::table('patient_informations')
->where('assignment_id', $assignment->id)
Expand Down
32 changes: 0 additions & 32 deletions tests/Feature/Instructors/QuestionsGetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,6 @@ public function setup(): void

}

/** @test */
public function owner_can_direct_import()
{
$this->actingAs($this->user)->postJson("/api/questions/{$this->assignment->id}/direct-import-question",
['direct_import' => "query-1860", 'type' => 'libretexts id'])
->assertJson(['direct_import_id_added_to_assignment' => 'query-1860']);

}


/** @test */
public function cannot_remix_assignment_of_based_on_weights_and_submissions_exist()
Expand Down Expand Up @@ -508,29 +499,6 @@ public function page_ids_must_be_valid()
}


/** @test */
public function direct_import_will_not_repeat_questions()
{

$this->actingAs($this->user)->postJson("/api/questions/{$this->assignment->id}/direct-import-question",
['direct_import' => 'query-1860', 'type' => 'libretexts id']);

$this->actingAs($this->user)->postJson("/api/questions/{$this->assignment->id}/direct-import-question",
['direct_import' => 'query-1860', 'type' => 'libretexts id'])
->assertJson(['direct_import_id_not_added_to_assignment' => 'query-1860']);

}

/** @test */
public function direct_import_should_be_of_the_correct_form()
{

$this->actingAs($this->user)->postJson("/api/questions/{$this->assignment->id}/direct-import-question",
['direct_import' => 'bad form', 'type' => 'libretexts id'])
->assertJson(['message' => 'bad form should be of the form {library}-{page id}.']);

}


/** @test */
public function can_remove_a_question_from_an_assignment_if_you_are_the_owner()
Expand Down
19 changes: 19 additions & 0 deletions tests/Feature/QuestionsViewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,24 @@ public function createQTIMatchingQuestion($points): int
return $question_id;
}



/** @test */
public function non_enrolled_student_cannot_view_case_study_info()
{
$this->actingAs($this->student_user_2)->getJson("/api/case-study-notes/assignment/{$this->assignment->id}/order/1")
->assertJson(['message' => 'You are not allowed to access this assignment.']);

}
/** @test */
public function enrolled_student_can_view_case_study_info()
{
$this->actingAs($this->student_user)->getJson("/api/case-study-notes/assignment/{$this->assignment->id}/order/1")
->assertJson(['type' => 'success']);
}



/** @test */
public function user_cannot_get_query_page_if_page_id_is_not_in_one_of_their_assignments()
{
Expand Down Expand Up @@ -2456,6 +2474,7 @@ public function student_can_view_questions_info()
->assertJson(['type' => 'success']);
}


/** @test */

public function student_cannot_view_questions_info_if_not_enrolled_in_the_course()
Expand Down

0 comments on commit ebfde49

Please sign in to comment.