Skip to content

Commit 1650ec2

Browse files
Han Wei TeoHan Wei Teo
authored andcommitted
remove db_assignments db_students
1 parent 0e867fe commit 1650ec2

15 files changed

+252
-265
lines changed

nbgrader/apps/baseapp.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,6 @@ def _load_config(self, cfg, **kwargs):
222222
("autograded_directory", "autograded_directory"),
223223
("feedback_directory", "feedback_directory"),
224224
("db_url", "db_url"),
225-
("db_assignments", "db_assignments"),
226-
("db_students", "db_students"),
227225
("course_directory", "root"),
228226
("ignore", "ignore")
229227
]

nbgrader/apps/quickstartapp.py

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,29 @@ def start(self):
129129
os.chdir(currdir)
130130
with open(os.path.join(course_path, "nbgrader_config.py"), "r") as fh:
131131
config = fh.read()
132+
133+
# # Update this list with other assignments you want
134+
# c.CourseDirectory.db_assignments = [dict(name="ps1")]
135+
#
136+
# # Change the students in this list with that actual students in
137+
# # your course
138+
# c.CourseDirectory.db_students = [
139+
# dict(id="bitdiddle", first_name="Ben", last_name="Bitdiddle"),
140+
# dict(id="hacker", first_name="Alyssa", last_name="Hacker"),
141+
# dict(id="reasoner", first_name="Louis", last_name="Reasoner")
142+
# ]
143+
subprocess.call([sys.executable, "-m", "nbgrader", "db", "assignment", "add", "ps1"], stdout=subprocess.PIPE,
144+
stderr=subprocess.STDOUT)
145+
subprocess.call([sys.executable, "-m", "nbgrader", "db", "student", "add", "bitdiddle", "--first-name", "Ben",
146+
"--last-name", "Bitdiddle"],
147+
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
148+
subprocess.call([sys.executable, "-m", "nbgrader", "db", "student", "add", "hacker", "--first-name", "Alyssa",
149+
"--last-name", "Hacker"],
150+
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
151+
subprocess.call([sys.executable, "-m", "nbgrader", "db", "student", "add", "reasoner", "--first-name", "Louis",
152+
"--last-name", "Reasoner"],
153+
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
154+
132155
with open(os.path.join(course_path, "nbgrader_config.py"), "w") as fh:
133156
fh.write("c = get_config()\n\n")
134157
fh.write("#" * 79 + "\n")
@@ -140,17 +163,6 @@ def start(self):
140163
# server set up.
141164
c.CourseDirectory.course_id = "{}"
142165
143-
# Update this list with other assignments you want
144-
c.CourseDirectory.db_assignments = [dict(name="ps1")]
145-
146-
# Change the students in this list with that actual students in
147-
# your course
148-
c.CourseDirectory.db_students = [
149-
dict(id="bitdiddle", first_name="Ben", last_name="Bitdiddle"),
150-
dict(id="hacker", first_name="Alyssa", last_name="Hacker"),
151-
dict(id="reasoner", first_name="Louis", last_name="Reasoner")
152-
]
153-
154166
c.IncludeHeaderFooter.header = "source/header.ipynb"
155167
"""
156168
).format(course_id))

nbgrader/converters/autograde.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,6 @@ def init_assignment(self, assignment_id, student_id):
7272
# try to get the student from the database, and throw an error if it
7373
# doesn't exist
7474
student = {}
75-
for s in self.coursedir.db_students:
76-
if s['id'] == student_id:
77-
student = s.copy()
78-
break
7975

8076
if student or self.create_student:
8177
if 'id' in student:

nbgrader/converters/generate_assignment.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,6 @@ def init_assignment(self, assignment_id, student_id):
129129
# doesn't exist
130130
if not self.no_database:
131131
assignment = {}
132-
for a in self.coursedir.db_assignments:
133-
if a['name'] == assignment_id:
134-
assignment = a.copy()
135-
break
136132

137133
if assignment or self.create_assignment:
138134
if 'name' in assignment:

nbgrader/coursedir.py

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -187,39 +187,6 @@ def _db_url_default(self):
187187
return "sqlite:///{}".format(
188188
os.path.abspath(os.path.join(self.root, "gradebook.db")))
189189

190-
db_assignments = List(
191-
help=dedent(
192-
"""
193-
A list of assignments that will be created in the database. Each
194-
item in the list should be a dictionary with the following keys:
195-
196-
- name
197-
- duedate (optional)
198-
199-
The values will be stored in the database. Please see the API
200-
documentation on the `Assignment` database model for details on
201-
these fields.
202-
"""
203-
)
204-
).tag(config=True)
205-
206-
db_students = List(
207-
help=dedent(
208-
"""
209-
A list of student that will be created in the database. Each
210-
item in the list should be a dictionary with the following keys:
211-
212-
- id
213-
- first_name (optional)
214-
- last_name (optional)
215-
- email (optional)
216-
217-
The values will be stored in the database. Please see the API
218-
documentation on the `Student` database model for details on
219-
these fields.
220-
"""
221-
)
222-
).tag(config=True)
223190

224191
root = Unicode(
225192
'',

nbgrader/docs/source/user_guide/managing_the_database.ipynb

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,23 +50,14 @@
5050
"source": [
5151
"Most of the important information that nbgrader has access to---information about students, assignments, grades, etc.---is stored in the nbgrader database. Much of this is added to the database automatically by nbgrader, with the exception of two types of information: which students are in your class, and which assignments you have.\n",
5252
"\n",
53-
"There are three methods for adding students and assignments to the database. The first is by declaring them explicitly in the `nbgrader_config.py` file, such as:\n",
54-
"\n",
55-
"```python\n",
56-
"c = get_config()\n",
57-
"c.CourseDirectory.db_assignments = [dict(name=\"ps1\", duedate=\"2015-02-02 17:00:00 UTC\")]\n",
58-
"c.CourseDirectory.db_students = [\n",
59-
" dict(id=\"bitdiddle\", first_name=\"Ben\", last_name=\"Bitdiddle\"),\n",
60-
" dict(id=\"hacker\", first_name=\"Alyssa\", last_name=\"Hacker\")\n",
61-
"]\n",
62-
"```"
53+
"There are two methods for adding students and assignments to the database."
6354
]
6455
},
6556
{
6657
"cell_type": "raw",
6758
"metadata": {},
6859
"source": [
69-
"The second is by writing a Python script and using the :doc:`API </api/index>`. The third way is to use the command line tool ``nbgrader db``, which provides limited command line access to some of the API functionality."
60+
"The first is by writing a Python script and using the :doc:`API </api/index>`. The second way is to use the command line tool ``nbgrader db``, which provides limited command line access to some of the API functionality."
7061
]
7162
},
7263
{
@@ -365,8 +356,17 @@
365356
"display_name": "Python",
366357
"language": "python",
367358
"name": "python"
359+
},
360+
"pycharm": {
361+
"stem_cell": {
362+
"cell_type": "raw",
363+
"source": [],
364+
"metadata": {
365+
"collapsed": false
366+
}
367+
}
368368
}
369369
},
370370
"nbformat": 4,
371371
"nbformat_minor": 2
372-
}
372+
}

0 commit comments

Comments
 (0)