From 30487909db0185b329067ee32e9fb16f24e326f4 Mon Sep 17 00:00:00 2001 From: Neal Davis Date: Tue, 31 Jan 2017 10:59:22 -0600 Subject: [PATCH 1/4] Clarify how timing rules work in facilities. Including an exemption for DRES students. --- flows/exam-1.yml | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/flows/exam-1.yml b/flows/exam-1.yml index 6ad7694..93b336e 100644 --- a/flows/exam-1.yml +++ b/flows/exam-1.yml @@ -28,24 +28,28 @@ rules: permissions: [] - - if_in_facility: test_center - if_session_duration_shorter_than_minutes: 0.5 - permissions: [view, submit_answer, end_session, see_session_time, lock_down_as_exam_session] + if_has_role: [instructor] + permissions: [view, submit_answer, change_answer, end_session, see_correctness, see_session_time] - - if_in_facility: test_center - message: "You exam will end soon." - if_session_duration_shorter_than_minutes: 1 - permissions: [view, submit_answer, end_session, see_session_time, lock_down_as_exam_session] + if_in_facility: "cbtf" + if_session_duration_shorter_than_minutes: 45 # length until warning appears + permissions: [view, submit_answer, change_answer, end_session, see_correctness, see_session_time, lock_down_as_exam_session] - - if_in_facility: test_center + if_in_facility: "cbtf" + message: "Your exam will end soon." + if_session_duration_shorter_than_minutes: 120 # keep in mind DRES students! + permissions: [view, submit_answer, change_answer, end_session, see_correctness, see_session_time, lock_down_as_exam_session] + + - + if_in_facility: "cbtf" if_in_progress: True - message: "You exam has ended. You may no longer make changes. Please click 'Submit assignment' to finish." - permissions: [view, end_session, see_correctness, see_session_time, lock_down_as_exam_session] + message: "Your exam has ended. You may no longer make changes to your answers. Please click 'Submit assignment' to finish." + permissions: [view, change_answer, end_session, see_correctness, see_correctness, see_session_time, lock_down_as_exam_session] - - if_in_facility: test_center + if_in_facility: "cbtf" permissions: [view, see_correctness, see_session_time] - From 3754df8c4abee5c2d6c596d49ce54555066a282f Mon Sep 17 00:00:00 2001 From: Neal Davis Date: Sat, 15 Dec 2018 02:52:42 -0600 Subject: [PATCH 2/4] Create f.m --- question-data/f.m | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 question-data/f.m diff --git a/question-data/f.m b/question-data/f.m new file mode 100644 index 0000000..12aae8a --- /dev/null +++ b/question-data/f.m @@ -0,0 +1,3 @@ +function [ y ] = f( x ) + y = exp( -x .^ 2 ); +end %function From 32330c6e700094f51e5b906af4c3c1788cc4d9eb Mon Sep 17 00:00:00 2001 From: Neal Davis Date: Tue, 9 Apr 2019 10:01:22 -0500 Subject: [PATCH 3/4] Post Octave/Python flow. --- flows/002-oct-py-test.yml | 142 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 flows/002-oct-py-test.yml diff --git a/flows/002-oct-py-test.yml b/flows/002-oct-py-test.yml new file mode 100644 index 0000000..ddc265a --- /dev/null +++ b/flows/002-oct-py-test.yml @@ -0,0 +1,142 @@ +title: "Octave and Python Code" +description: | + # Octave and Python Code + +rules: + access: + - + if_has_role: [student, ta, instructor] + permissions: [view] + + grade_identifier: null + +pages: + +################################################################################ +- + type: OctaveCodeQuestion + id: octave_test_apply_function + value: 1 + timeout: 10 + title: "Applying a Function in Octave" + access_rules: + add_permissions: + - see_correctness + - change_answer + + prompt: | + ### Applying a Function in Octave + + Apply the provided function `f` to the provided array `x`. Store the result in `y`. + + (`x` has the value `[ 1 2 3 4 5 ]` and is already defined and available for you.) + + setup_code: | + x = [ 1 2 3 4 5 ]; + + initial_code: | + y = f( ___ ); + + names_for_user: [ x ] + + names_from_user: [ y ] + + data_files: [ "./question-data/f.m" ] + + test_code: | + pts = 0.0 + + try: + from oct2py import octave + from oct2py import Struct,Cell,StructArray + + import numpy as np + + test_y = octave.eval( "exp( -[ 1 2 3 4 5 ] .^ 2 );" ) + + assert np.allclose( y,test_y ) + pts = 1.0 + + except NameError: + feedback.finish( 0.0,'Something is wrong. Have you created `y`?' ) + except AssertionError: + feedback.finish( 0.0,'Something is wrong. Have you used `f` on `x` to obtain `y`?' ) + except: + feedback.finish( 0.0,'Keep trying. If you get stuck, please ask a TA for help on Piazza or office hours.' ) + + if np.isclose( pts,1.0 ): + feedback.finish( pts,'Success! You have evaluated the function correctly.' ) + else: + feedback.finish( pts,'Keep trying. If you get stuck, please ask a TA for help on Piazza or office hours.' ) + + + correct_code: | + y = f(x); + +################################################################################ +- + type: PythonCodeQuestion + id: python_test_apply_function + value: 1 + timeout: 10 + title: "Applying a Function in Python" + access_rules: + add_permissions: + - see_correctness + - change_answer + + prompt: | + ### Applying a Function in Python + + Apply the provided function `f` to the provided array `x`. Store the result in `y`. + + (`x` has the value `numpy.ndarray( [ 1,2,3,4,5 ] )` and is already defined and available for you.) + + setup_code: | + import numpy as np + x = np.array( [ 1,2,3,4,5 ] ); + def f( x ): + return np.exp( -x**2 ) + + initial_code: | + y = f( ___ ); + + names_for_user: [ x,f ] + + names_from_user: [ y ] + + data_files: [ ] + + test_code: | + pts = 0.0 + + try: + import numpy as np + + test_x = np.array( [ 1,2,3,4,5 ] ); + test_y = np.exp( -x ** 2 ) + + assert np.allclose( y,test_y ) + pts = 1.0 + + except NameError: + feedback.finish( 0.0,'Something is wrong. Have you created `y`?' ) + except AssertionError: + feedback.finish( 0.0,'Something is wrong. Have you used `f` on `x` to obtain `y`?' ) + except: + feedback.finish( 0.0,'Keep trying. If you get stuck, please ask a TA for help on Piazza or office hours.' ) + + if np.isclose( pts,1.0 ): + feedback.finish( pts,'Success! You have evaluated the function correctly.' ) + else: + feedback.finish( pts,'Keep trying. If you get stuck, please ask a TA for help on Piazza or office hours.' ) + + + correct_code: | + y = f(x); + +completion_text: | + + # End of Octave and Python Code Test + + Hopefully things are working well! From 7e3a8a9eeac7ea5510195f62ecbc6fa1411a4a51 Mon Sep 17 00:00:00 2001 From: Neal Davis Date: Tue, 9 Apr 2019 10:03:48 -0500 Subject: [PATCH 4/4] Post Octave/Python flow. --- flows/002-oct-py-test.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/flows/002-oct-py-test.yml b/flows/002-oct-py-test.yml index ddc265a..889bcf0 100644 --- a/flows/002-oct-py-test.yml +++ b/flows/002-oct-py-test.yml @@ -6,7 +6,7 @@ rules: access: - if_has_role: [student, ta, instructor] - permissions: [view] + permissions: [view,end_session] grade_identifier: null @@ -21,8 +21,9 @@ pages: title: "Applying a Function in Octave" access_rules: add_permissions: - - see_correctness + - submit_answer - change_answer + - see_correctness prompt: | ### Applying a Function in Octave @@ -82,8 +83,9 @@ pages: title: "Applying a Function in Python" access_rules: add_permissions: - - see_correctness + - submit_answer - change_answer + - see_correctness prompt: | ### Applying a Function in Python