Skip to content
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

Fix assignment summary in Otter Assign so that manual questions are include #911

Merged
merged 25 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
88002a3
debugging failed builds
chrispyles Dec 31, 2024
b0f61fa
debugging failed builds
chrispyles Dec 31, 2024
b98b7ee
debugging failed builds
chrispyles Dec 31, 2024
d1d93b9
debugging failed builds
chrispyles Dec 31, 2024
8a0bf56
debugging failed builds
chrispyles Dec 31, 2024
1bc3a13
debugging failed builds
chrispyles Dec 31, 2024
c340447
debugging failed builds
chrispyles Dec 31, 2024
4680ade
free disk space in CI runs using docker to prevent image build failures
chrispyles Dec 31, 2024
e5a8e40
add comment about source
chrispyles Dec 31, 2024
92686fc
reorg workflow, add support for docker gha cache in CI
chrispyles Dec 31, 2024
86fc144
undo gha caching changes since it's already done in conftest.py
chrispyles Dec 31, 2024
7f695e8
debugging failed builds
chrispyles Dec 31, 2024
8931a50
debugging failed builds
chrispyles Dec 31, 2024
0e8b710
remove alternate_file
chrispyles Dec 31, 2024
eba239f
debugging failed builds
chrispyles Jan 1, 2025
84b10c2
debugging failed builds
chrispyles Jan 1, 2025
364f4c5
debugging failed builds
chrispyles Jan 1, 2025
6b0f5c8
debugging failed builds
chrispyles Jan 1, 2025
d125fd6
debugging failed builds
chrispyles Jan 1, 2025
4add990
debugging failed builds
chrispyles Jan 1, 2025
44129aa
debugging failed builds
chrispyles Jan 1, 2025
060a6be
Merge branch 'master' of https://github.com/ucbds-infra/otter-grader
chrispyles Jan 1, 2025
e474447
Merge remote-tracking branch 'upstream/master'
chrispyles Jan 2, 2025
733bf06
Merge branch 'master' of https://github.com/ucbds-infra/otter-grader
chrispyles Jan 24, 2025
08afd79
include manual questions in assignment summary
chrispyles Jan 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
**v6.1.0 (unreleased):**

* Update Otter Assign to handle notebooks with an invalid kernelspec by assuming the language is Python per [#895](https://github.com/ucbds-infra/otter-grader/issues/895)
* Fixed assignment summary in Otter Assign so that manual questions are included per [#886](https://github.com/ucbds-infra/otter-grader/issues/886)

**v6.0.5:**

Expand Down
1 change: 1 addition & 0 deletions otter/assign/notebook_transformer.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ def _get_transformed_cells(self, cells: list[nbf.NotebookNode]) -> list[nbf.Note
)

question = QuestionConfig(question_config)
self.tests_mgr.add_question(question)
if question.manual or question.export:
need_begin_export = True

Expand Down
1 change: 0 additions & 1 deletion otter/assign/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import pathlib
import shutil
import tempfile
import warnings

from .assignment import Assignment
from .notebook_transformer import NotebookTransformer, TransformedNotebookContainer
Expand Down
30 changes: 21 additions & 9 deletions otter/assign/tests_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,8 @@ def _add_test_case(self, question: QuestionConfig, test_case: TestCase):
question (``otter.assign.question_config.QuestionConfig``): the question config
test_case (``TestCase``): the test case to track
"""
question_name = question["name"]
self._questions[question_name] = question

if question_name not in self._tests_by_question:
self._tests_by_question[question_name] = []

self._tests_by_question[question_name].append(test_case)
self.add_question(question)
self._tests_by_question[question.name].append(test_case)

def _parse_test_config(self, source: list[str]) -> tuple[dict[str, Any], Union[int, None]]:
"""
Expand All @@ -114,6 +109,17 @@ def _parse_test_config(self, source: list[str]) -> tuple[dict[str, Any], Union[i

return config, i

def add_question(self, question: QuestionConfig):
"""
Add a question for tracking and inclusion in the assignment summary

Args:
question (``otter.assign.question_config.QuestionConfig``): the question config
"""
self._questions[question.name] = question
if question.name not in self._tests_by_question:
self._tests_by_question[question.name] = []

def read_test(self, cell: nbf.NotebookNode, question: QuestionConfig):
"""
Parse and track a test case from the provided cell for the specified question.
Expand Down Expand Up @@ -184,7 +190,7 @@ def has_tests(self, question: QuestionConfig) -> bool:
Returns:
``bool``: whether the question has any test cases
"""
return question.name in self._tests_by_question
return len(self._tests_by_question.get(question.name, [])) > 0

@staticmethod
def _resolve_test_file_points(
Expand Down Expand Up @@ -356,6 +362,9 @@ def write_tests(

test_ext = ".py" if self.assignment.is_python else ".R"
for test_name in self._tests_by_question.keys():
if not self._tests_by_question[test_name]:
continue

test_info = self._create_test_file_info(test_name)
test_path = os.path.join(test_dir, test_name + test_ext)

Expand Down Expand Up @@ -397,6 +406,9 @@ def determine_question_point_value(self, question: QuestionConfig) -> Union[int,
Returns:
``int | float``: the point value of the question
"""
if question.manual:
return question.points or 0

test_cases = self._tests_by_question.get(question.name, [])

points = question.points
Expand Down Expand Up @@ -430,7 +442,7 @@ def generate_assignment_summary(self) -> str:
for question_name in sorted(self._tests_by_question.keys()):
config = self._questions[question_name]
points = self.determine_question_point_value(config)
rows.append({"name": question_name, "points": points})
rows.append({"name": question_name, "points": points, "manual": config.manual})
total += points
if config.manual:
manual += points
Expand Down
Loading