From a6de7627d8057c800bcb19aec5e69aa87c4caf2b Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Thu, 5 Mar 2020 18:35:55 -0600 Subject: [PATCH 1/2] Fix logic in get_interaction_kind --- course/flow.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/course/flow.py b/course/flow.py index eca742d7..4f4eb4c5 100644 --- a/course/flow.py +++ b/course/flow.py @@ -598,22 +598,28 @@ def get_interaction_kind( ): # type: (...) -> Text - ikind = flow_session_interaction_kind.noninteractive + has_interactive = False + has_gradable = False for i, page_data in enumerate(all_page_data): assert i == page_data.page_ordinal page = instantiate_flow_page_with_ctx(fctx, page_data) if page.expects_answer(): + has_interactive = True if page.is_answer_gradable(): - if flow_generates_grade: - return flow_session_interaction_kind.permanent_grade - else: - return flow_session_interaction_kind.practice_grade - else: - return flow_session_interaction_kind.ungraded + has_gradable = True - return ikind + if has_interactive: + if has_gradable: + if flow_generates_grade: + return flow_session_interaction_kind.permanent_grade + else: + return flow_session_interaction_kind.practice_grade + else: + return flow_session_interaction_kind.ungraded + else: + return flow_session_interaction_kind.noninteractive def get_session_answered_page_data( -- GitLab From d2506cffc3753d15cb4b5489a896a83bea278d63 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Thu, 5 Mar 2020 18:49:10 -0600 Subject: [PATCH 2/2] Disable invalid test_remove_page_with_non_ordinal --- tests/test_flow/test_flow.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_flow/test_flow.py b/tests/test_flow/test_flow.py index cfded35c..7fdc7667 100644 --- a/tests/test_flow/test_flow.py +++ b/tests/test_flow/test_flow.py @@ -140,7 +140,9 @@ class AdjustFlowSessionPageDataTest( models.FlowPageData.objects.get(page_id=page_id).page_ordinal) # }}} - def test_remove_page_with_non_ordinal(self): + # disabled by AK 2020-05-03: why is it valid to set a flow page's ordinal + # to None while it is in use? + def no_test_remove_page_with_non_ordinal(self): resp = self.c.get(self.get_page_url_by_ordinal(0)) self.assertEqual(resp.status_code, 200) -- GitLab