Skip to content

Django command to post submissions to ora - #2001

Merged
symbolist merged 1 commit into
masterfrom
waheed/openended-problems-commands-2
Jan 6, 2014
Merged

Django command to post submissions to ora#2001
symbolist merged 1 commit into
masterfrom
waheed/openended-problems-commands-2

Conversation

@symbolist

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread lms/djangoapps/instructor/utils.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

See Ned's comments from #1946

@symbolist

Copy link
Copy Markdown
Contributor Author

@cpennington @nedbat @wedaly please review.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The read_only=True should only be enabled with a command line argument. Will fix this.

@wedaly

wedaly commented Dec 20, 2013

Copy link
Copy Markdown
Contributor

I don't see any unit tests for this command or for the code you changed in combined_open_ended_modulev1.py

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The current implementation of send_to_grader method always returns True, even if the XQueue interface reports an error. As far as I can tell, nothing in the system uses that return value. This might be a good time to update send_to_grader to return False on failure, then handle that condition explicitly here.

@symbolist

Copy link
Copy Markdown
Contributor Author

Thanks everyone for the detailed review and suggestions. I have made changes accordingly. Please have a look again.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@cpennington I have replaced get_current_task with get_task_at_index(task_index) and task_index can be specified as an argument to the commands. This will ensure that for multi-step problems the commands only operate on the intended step.

@symbolist

Copy link
Copy Markdown
Contributor Author

@wedaly I am already working on a separate branch for the fix to send_to_grader(). I am going to add some tests for the changes in /xmodule but I am not sure how to test the commands?

@wedaly

wedaly commented Dec 20, 2013

Copy link
Copy Markdown
Contributor

@symbolist Create a test course with a CourseFactory and add an open ended problem. We have lots of examples in the code base of using factories to set this up, although I don't know that we have any for open ended problems specifically.

I'd recommend patching / mocking the network call that posts the submission to verify it has the correct data. The easiest way to do this is to replace the xqueue interface object with a mock (in the runtime system passed to the open ended module). This will allow you to verify both success and failure conditions.

There are examples of testing Django commands in the codebase: just look for "tests" folders inside "management/commands" packages.

@symbolist

Copy link
Copy Markdown
Contributor Author

@wedaly I added some tests. Do they look okay?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm seeing that this line is uncovered by the tests. I'm not sure I understand when this line would be executed -- could you please clarify?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

When a student saves an answer (but not submits it) it is stored in task.stored_answer. But whether they have just looked at the problem or saved an answer the task_state == OpenEndedChild.INITIAL. Should I cover this too?

@wedaly

wedaly commented Jan 3, 2014

Copy link
Copy Markdown
Contributor

@symbolist The tests look good. 👍 when you make the style fix and cover the missing line with a test case.

@symbolist

Copy link
Copy Markdown
Contributor Author

@cpennington I have refactored according to your suggestions. Can you give it a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants