This file is indexed.

/usr/lib/python2.7/dist-packages/schooltool/gradebook/browser/ftests/report_card.txt is in python-schooltool.gradebook 2.6.3-0ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
============
Report Cards
============

The end goal of having users enter grades is for parents to receive a
report card from the school after each grading period has ended.  To facilitate
this, the admin user will set up report sheet templates at the application
level, then choose on to deploy to a given term.  This deployment will
result in a special worksheet being inserted into every section for that
term so that the teachers can enter the final grades of the grading period.
Finally, the admin user will be able to request report cards to be printed
after each gradding period has ended.

Let's start by setting up the application and logging in as manager.

    >>> from schooltool.app.browser.ftests import setup
    >>> setup.setUpBasicSchool()
    >>> manager = Browser('manager', 'schooltool')

If at this point, when we have no report sheets yet, we go to a term
and try to deploy one, we should get an error:

    >>> manager.getLink('Manage').click()
    >>> manager.getLink('2005-2006').click()
    >>> manager.getLink('Fall').click()
    >>> manager.getLink('Deploy Report Sheet').click()
    >>> manager.printQuery('//h1/text()')
    The operation you attempted cannot be completed because there are
    currently no report sheets set up in your SchoolTool
    instance. Please have a user with administration access set up at
    least one report sheet and try the operation again.

The same should happen if we try to deploy from a school year:

    >>> manager.getLink('Manage').click()
    >>> manager.getLink('2005-2006').click()
    >>> manager.getLink('Deploy Report Sheet').click()
    >>> manager.printQuery('//h1/text()')
    The operation you attempted cannot be completed because there are
    currently no report sheets set up in your SchoolTool
    instance. Please have a user with administration access set up at
    least one report sheet and try the operation again.

So, let's set up the report sheet templates.  This is done from the
Manage tab.

    >>> manager.getLink('Manage').click()
    >>> manager.getLink('Report Sheet Templates').click()

We see that there are no report worksheets yet.

    >>> manager.printQuery('id("content-body")//a')

We'll add one.

    >>> manager.getLink('New Report Sheet').click()
    >>> manager.getControl('Title').value = 'Test1'
    >>> manager.getControl('Add').click()

Now we see that the new report worksheet appears in the list.

    >>> manager.printQuery('id("content-body")//a')
    <a href="http://localhost/schooltool.gradebook/templates/ReportWorksheet">Test1</a>

We'll click on it to view its activities.  We see that there are none.

    >>> manager.getLink('Test1').click()
    >>> manager.printQuery('id("content-body")//a')

To add a report activity to it, we'll click on the supplied link.

    >>> manager.getLink('New Report Activity').click()
    >>> manager.getControl('Title').value = 'Activity 1'
    >>> manager.getControl('Score System').displayValue = ['100 Points']
    >>> manager.getControl('Add').click()

Now we see that the new report activity appears in the list.

    >>> manager.printQuery('id("content-body")//a')
    <a href="http://localhost/schooltool.gradebook/templates/ReportWorksheet/ReportActivity">Activity 1</a>

Next, we'll click on the newly added activity link to edit its score system.
We see that it is currently set to the 100 points score system we selected
when we added it.

    >>> manager.getLink('Activity 1').click()
    >>> manager.getControl('Score System').value
    ['100 Points-']

We'll change it, apply the change, and revisit the activity to see that the
change took.

    >>> manager.getControl('Score System').value = ['letter-grade-']
    >>> manager.getControl('Apply').click()
    >>> manager.getLink('Activity 1').click()
    >>> manager.getControl('Score System').value
    ['letter-grade-']

Now we'll change it to use a dynamically generated ranged values score system.
The min and max fields don't need to be filled in as they defualt to 0 and 100.

    >>> manager.getControl('Score System').displayValue = ['-- Use range below --']
    >>> manager.getControl('Apply').click()
    >>> manager.getLink('Activity 1').click()
    >>> manager.getControl('Score System').value
    ['ranged']
    >>> manager.getControl('Minimum').value
    '0'
    >>> manager.getControl('Maximum').value
    '100'

Next we'll simply change the ranges and verify.

    >>> manager.getControl('Minimum').value = '1'
    >>> manager.getControl('Maximum').value = '5'
    >>> manager.getControl('Apply').click()
    >>> manager.getLink('Activity 1').click()
    >>> manager.getControl('Score System').value
    ['ranged']
    >>> manager.getControl('Minimum').value
    '1'
    >>> manager.getControl('Maximum').value
    '5'

Finally, we'll make sure we can change it back to an existing score system.
We'll note that, in doing so, the min and max fields are cleared out.  They
are only relavent when '-- Use range below --' is chosen as the score system.

    >>> manager.getControl('Score System').displayValue = ['100 Points']
    >>> manager.getControl('Apply').click()
    >>> manager.getLink('Activity 1').click()
    >>> manager.getControl('Score System').value
    ['100 Points-']
    >>> manager.getControl('Minimum').value
    ''
    >>> manager.getControl('Maximum').value
    ''

Later we will want to test the handling of deployment of multiple templates
to a term, so here we'll set up a second template.

    >>> manager.getLink('Manage').click()
    >>> manager.getLink('Report Sheet Templates').click()
    >>> manager.getLink('New Report Sheet').click()
    >>> manager.getControl('Title').value = 'Test2'
    >>> manager.getControl('Add').click()
    >>> manager.getLink('Test2').click()
    >>> manager.getLink('New Report Activity').click()
    >>> manager.getControl('Title').value = 'Activity 2'
    >>> manager.getControl('Add').click()


Report Worksheet Deployment
---------------------------

Now that we've set up report sheet templates, we want to choose one of them
to deploy to all sections in a given term.  We'll need to set up one of our
terms with some sections.  Of course, we'll need a teacher and some students
in order to do that.

    >>> from schooltool.basicperson.browser.ftests.setup import addPerson
    >>> addPerson('Teacher1', 'One', 'teacher1', 'pwd')
    >>> addPerson('Student1', 'One', 'student1', 'pwd')
    >>> addPerson('Student2', 'Two', 'student2', 'pwd')
    >>> setup.addCourse('CompSci I', '2005-2006')
    >>> setup.addSection('CompSci I', '2005-2006', 'Spring',
    ...                  title='Morning CompSci I',
    ...                  instructors=['Teacher1'],
    ...                  members=['Student1','Student2'])
    >>> setup.addSection('CompSci I', '2005-2006', 'Spring',
    ...                  title='Afternoon CompSci I',
    ...                  instructors=['Teacher1'],
    ...                  members=['Student1','Student2'])

We'll navigate to the 'Spring' term where we just created the two sections,
and we'll click on the 'Deploy Report Sheet' link.

    >>> manager.getLink('2005-2006').click()
    >>> manager.getLink('Spring').click()
    >>> manager.printQuery('//h1/text()')
    Spring
    >>> manager.getLink('Deploy Report Sheet').click()

Hitting the 'Cancel' button brings us back to the term view.

    >>> manager.getControl('Cancel').click()
    >>> manager.printQuery('//h1/text()')
    Spring

Now we'll go back to the view and this time hit the 'Deploy' button.  This will
also bring us back to the term view.  First we'll deploy the first template,
then the second.

    >>> manager.getLink('Deploy Report Sheet').click()
    >>> manager.getControl('Template').displayValue = ['Test1']
    >>> manager.getControl('Deploy').click()
    >>> manager.printQuery('//h1/text()')
    Spring
    >>> manager.getLink('Deploy Report Sheet').click()
    >>> manager.getControl('Template').displayValue = ['Test2']
    >>> manager.getControl('Deploy').click()

To make sure the deployment worked, we'll navigate to each section and make sure
the worksheets and activities are there.  We'll start with the first section.
In addition to testing for the presence of the worksheets and activities, we'll
make sure that there is no checkbox available to delete any of them.  Also,
the activities will be spans instead of links so that they can't be edited.

    >>> manager.getLink('Sections').click()
    >>> manager.getLink('Morning CompSci I').click()
    >>> manager.getLink('Gradebook', index=1).click()
    >>> manager.getLink('Worksheets').click()

    >>> manager.printQuery('id("content-body")//a')
    <a href="http://localhost/schoolyears/2005-2006/spring/sections/1/activities/2005-2006_spring/manage.html">Test1</a>
    <a href="http://localhost/schoolyears/2005-2006/spring/sections/1/activities/2005-2006_spring-2/manage.html">Test2</a>
    <a href="http://localhost/schoolyears/2005-2006/spring/sections/1/activities/Worksheet/manage.html">Sheet1</a>

    >>> manager.getLink('Test1').click()
    >>> manager.printQuery('id("content-body")//span')
    <span>Activity 1</span>

    >>> 'checkbox' not in manager.queryHTML('id("content-body")')[0]
    True

    >>> '<a>' not in manager.queryHTML('id("content-body")')[0]
    True

    >>> manager.getLink('Worksheets').click()
    >>> manager.getLink('Test2').click()
    >>> manager.printQuery('id("content-body")//span')
    <span>Activity 2</span>

    >>> 'checkbox' not in manager.queryHTML('id("content-body")')[0]
    True

    >>> '<a>' not in manager.queryHTML('id("content-body")')[0]
    True

The other section should also have the same worksheet deployed.

    >>> manager.getLink('2005-2006').click()
    >>> manager.getLink('Spring').click()
    >>> manager.getLink('Sections').click()
    >>> manager.getLink('Afternoon CompSci I').click()
    >>> manager.getLink('Gradebook', index=1).click()
    >>> manager.getLink('Worksheets').click()

    >>> manager.printQuery('id("content-body")//a')
    <a href="http://localhost/schoolyears/2005-2006/spring/sections/2/activities/2005-2006_spring/manage.html">Test1</a>
    <a href="http://localhost/schoolyears/2005-2006/spring/sections/2/activities/2005-2006_spring-2/manage.html">Test2</a>
    <a href="http://localhost/schoolyears/2005-2006/spring/sections/2/activities/Worksheet/manage.html">Sheet1</a>

    >>> manager.getLink('Test1').click()
    >>> manager.printQuery('id("content-body")//span')
    <span>Activity 1</span>

    >>> 'checkbox' not in manager.queryHTML('id("content-body")')[0]
    True

    >>> '<a>' not in manager.queryHTML('id("content-body")')[0]
    True

    >>> manager.getLink('Worksheets').click()
    >>> manager.getLink('Test2').click()
    >>> manager.printQuery('id("content-body")//span')
    <span>Activity 2</span>

    >>> 'checkbox' not in manager.queryHTML('id("content-body")')[0]
    True

    >>> '<a>' not in manager.queryHTML('id("content-body")')[0]
    True

For data integrity's sake, we have to have a subscriber to a new section event
to automatically add the same worksheets to it that are already deployed to the
other sections.  We'll add a third section to test this.

    >>> setup.addSection('CompSci I', '2005-2006', 'Spring',
    ...                  title='Evening CompSci I',
    ...                  instructors=['Teacher1'],
    ...                  members=['Student1','Student2'])

    >>> manager.getLink('2005-2006').click()
    >>> manager.getLink('Spring').click()
    >>> manager.getLink('Sections').click()
    >>> manager.getLink('Evening CompSci I').click()
    >>> manager.getLink('Gradebook', index=1).click()
    >>> manager.getLink('Worksheets').click()

    >>> manager.printQuery('id("content-body")//a')
    <a href="http://localhost/schoolyears/2005-2006/spring/sections/3/activities/2005-2006_spring/manage.html">Test1</a>
    <a href="http://localhost/schoolyears/2005-2006/spring/sections/3/activities/2005-2006_spring-2/manage.html">Test2</a>
    <a href="http://localhost/schoolyears/2005-2006/spring/sections/3/activities/Worksheet/manage.html">Sheet1</a>

    >>> manager.getLink('Test1').click()
    >>> manager.printQuery('id("content-body")//span')
    <span>Activity 1</span>

    >>> manager.getLink('Worksheets').click()
    >>> manager.getLink('Test2').click()
    >>> manager.printQuery('id("content-body")//span')
    <span>Activity 2</span>


Report Card Layout
------------------

Now that we have some templates deployed, we can move on to setting up the
layout of the report cards that will be printed after each marking period.
The layout view supports setting up which activities appear in the grid
and which appear in the outline portion of the report card.

Typically, at the end of each marking period, an admin user will request
a run of the report cards for the student body.  The result of that run will
come from the grid columns and outline activities that are set up in the
layout and the existence of grades for those activities entered by the
teachers.

We will need to set up at least one section in the Fall term and deploy yet a
third template to it.

    >>> setup.addSection('CompSci I', '2005-2006', 'Fall',
    ...                  title='Evening CompSci I',
    ...                  instructors=['Teacher1'],
    ...                  members=['Student1','Student2'])

    >>> manager.getLink('Manage').click()
    >>> manager.getLink('Report Sheet Templates').click()
    >>> manager.getLink('New Report Sheet').click()
    >>> manager.getControl('Title').value = 'Test3'
    >>> manager.getControl('Add').click()
    >>> manager.getLink('Test3').click()
    >>> manager.getLink('New Report Activity').click()
    >>> manager.getControl('Title').value = 'Activity 3'
    >>> manager.getControl('Add').click()

    >>> manager.getLink('2005-2006').click()
    >>> manager.getLink('Fall').click()
    >>> manager.printQuery('//h1/text()')
    Fall
    >>> manager.getLink('Deploy Report Sheet').click()
    >>> manager.getControl('Template').displayValue = ['Test3']
    >>> manager.getControl('Deploy').click()

Now the choices for our columns will be selectable over (term, worksheet,
activity).  Lets call up the column layout view and inspect the choices
we have.

    >>> manager.getLink('2005-2006').click()
    >>> manager.getLink('Report Card Layout').click()

The view starts off with no columns set up.  The 'New Column' select control is
the only list box present.

    >>> manager.printQuery("id('content-body')/form/fieldset[1]//table//tr[2]/td[2]//option")
    <option selected="selected" value="">Choose a column to add</option>
    <option value="fall|2005-2006_fall|ReportActivity">Fall - Test3 - Activity 3</option>
    <option value="spring|2005-2006_spring|ReportActivity">Spring - Test1 - Activity 1</option>
    <option value="spring|2005-2006_spring-2|ReportActivity">Spring - Test2 - Activity 2</option>
    <option value="absent">Absent</option>
    <option value="tardy">Tardy</option>

We'll add a first column to the layout.

    >>> manager.getControl('New Column').displayValue = ['Fall - Test3 - Activity 3']
    >>> manager.getControl(name='ADD_COLUMN').click()

Now the view has the first column and the select control below it to add
another column.

    >>> manager.printQuery("id('content-body')/form/fieldset[1]//table//tr[2]/td[2]//option")
    <option selected="selected" value="fall|2005-2006_fall|ReportActivity">Fall - Test3 - Activity 3</option>
    <option value="spring|2005-2006_spring|ReportActivity">Spring - Test1 - Activity 1</option>
    <option value="spring|2005-2006_spring-2|ReportActivity">Spring - Test2 - Activity 2</option>
    <option value="absent">Absent</option>
    <option value="tardy">Tardy</option>

    >>> manager.printQuery("id('content-body')/form/fieldset[1]//table//tr[3]/td[2]//option")
    <option selected="selected" value="">Choose a column to add</option>
    <option value="fall|2005-2006_fall|ReportActivity">Fall - Test3 - Activity 3</option>
    <option value="spring|2005-2006_spring|ReportActivity">Spring - Test1 - Activity 1</option>
    <option value="spring|2005-2006_spring-2|ReportActivity">Spring - Test2 - Activity 2</option>
    <option value="absent">Absent</option>
    <option value="tardy">Tardy</option>

We can change the first column to another activity.  We'll see that the change
has taken effect.

    >>> manager.getControl('Column1').displayValue = ['Spring - Test1 - Activity 1']
    >>> manager.getControl('OK').click()
    >>> manager.getLink('Report Card Layout').click()

    >>> manager.printQuery("id('content-body')/form/fieldset[1]//table//tr[2]/td[2]//option")
    <option value="fall|2005-2006_fall|ReportActivity">Fall - Test3 - Activity 3</option>
    <option selected="selected" value="spring|2005-2006_spring|ReportActivity">Spring - Test1 - Activity 1</option>
    <option value="spring|2005-2006_spring-2|ReportActivity">Spring - Test2 - Activity 2</option>
    <option value="absent">Absent</option>
    <option value="tardy">Tardy</option>

    >>> manager.printQuery("id('content-body')/form/fieldset[1]//table//tr[3]/td[2]//option")
    <option selected="selected" value="">Choose a column to add</option>
    <option value="fall|2005-2006_fall|ReportActivity">Fall - Test3 - Activity 3</option>
    <option value="spring|2005-2006_spring|ReportActivity">Spring - Test1 - Activity 1</option>
    <option value="spring|2005-2006_spring-2|ReportActivity">Spring - Test2 - Activity 2</option>
    <option value="absent">Absent</option>
    <option value="tardy">Tardy</option>

If we want, we can delete the column.  We'll see that the view no longer has
any columns.

    >>> manager.getControl(name='delete_Column1').click()

    >>> manager.printQuery("id('content-body')/form/fieldset[1]//table//tr[2]/td[2]//option")
    <option selected="selected" value="">Choose a column to add</option>
    <option value="fall|2005-2006_fall|ReportActivity">Fall - Test3 - Activity 3</option>
    <option value="spring|2005-2006_spring|ReportActivity">Spring - Test1 - Activity 1</option>
    <option value="spring|2005-2006_spring-2|ReportActivity">Spring - Test2 - Activity 2</option>
    <option value="absent">Absent</option>
    <option value="tardy">Tardy</option>

Next, we'll repeat the same set of tests for the outline activities.  For
starters, we see only choices for outline activities to add.

    >>> manager.printQuery("id('content-body')/form/fieldset[2]//table//tr[2]/td[2]//option")
    <option selected="selected" value="">Choose an activity to add</option>
    <option value="fall|2005-2006_fall|ReportActivity">Fall - Test3 - Activity 3</option>
    <option value="spring|2005-2006_spring|ReportActivity">Spring - Test1 - Activity 1</option>
    <option value="spring|2005-2006_spring-2|ReportActivity">Spring - Test2 - Activity 2</option>

We'll add a first activity to the layout.

    >>> manager.getControl('New Activity').displayValue = ['Fall - Test3 - Activity 3']
    >>> manager.getControl(name='ADD_ACTIVITY').click()

Now the view has the first activity and the select control below it to add
another activity.

    >>> manager.printQuery("id('content-body')/form/fieldset[2]//table//tr[2]/td[2]//option")
    <option selected="selected" value="fall|2005-2006_fall|ReportActivity">Fall - Test3 - Activity 3</option>
    <option value="spring|2005-2006_spring|ReportActivity">Spring - Test1 - Activity 1</option>
    <option value="spring|2005-2006_spring-2|ReportActivity">Spring - Test2 - Activity 2</option>

    >>> manager.printQuery("id('content-body')/form/fieldset[2]//table//tr[3]/td[2]//option")
    <option selected="selected" value="">Choose an activity to add</option>
    <option value="fall|2005-2006_fall|ReportActivity">Fall - Test3 - Activity 3</option>
    <option value="spring|2005-2006_spring|ReportActivity">Spring - Test1 - Activity 1</option>
    <option value="spring|2005-2006_spring-2|ReportActivity">Spring - Test2 - Activity 2</option>

We can change the first activity to another activity.  We'll see that the change
has taken effect.

    >>> manager.getControl('Activity1').displayValue = ['Spring - Test1 - Activity 1']
    >>> manager.getControl('OK').click()
    >>> manager.getLink('Report Card Layout').click()

    >>> manager.printQuery("id('content-body')/form/fieldset[2]//table//tr[2]/td[2]//option")
    <option value="fall|2005-2006_fall|ReportActivity">Fall - Test3 - Activity 3</option>
    <option selected="selected" value="spring|2005-2006_spring|ReportActivity">Spring - Test1 - Activity 1</option>
    <option value="spring|2005-2006_spring-2|ReportActivity">Spring - Test2 - Activity 2</option>

    >>> manager.printQuery("id('content-body')/form/fieldset[2]//table//tr[3]/td[2]//option")
    <option selected="selected" value="">Choose an activity to add</option>
    <option value="fall|2005-2006_fall|ReportActivity">Fall - Test3 - Activity 3</option>
    <option value="spring|2005-2006_spring|ReportActivity">Spring - Test1 - Activity 1</option>
    <option value="spring|2005-2006_spring-2|ReportActivity">Spring - Test2 - Activity 2</option>

If we want, we can delete the activity.  We'll see that the view no longer has
any activities.

    >>> manager.getControl(name='delete_Activity1').click()

    >>> manager.printQuery("id('content-body')/form/fieldset[2]//table//tr[2]/td[2]//option")
    <option selected="selected" value="">Choose an activity to add</option>
    <option value="fall|2005-2006_fall|ReportActivity">Fall - Test3 - Activity 3</option>
    <option value="spring|2005-2006_spring|ReportActivity">Spring - Test1 - Activity 1</option>
    <option value="spring|2005-2006_spring-2|ReportActivity">Spring - Test2 - Activity 2</option>

Now, let's delete a report activity:

    >>> manager.getLink('Manage').click()
    >>> manager.getLink('Report Sheet Templates').click()
    >>> manager.getLink('Test1').click()
    >>> manager.queryHTML('//form/div[not(@class="controls")]/a/text()')
    ['Activity 1']
    >>> manager.getControl(name='delete:list').value = ['ReportActivity']
    >>> manager.getControl('Delete').click()
    >>> manager.queryHTML('//form/div[not(@class="controls")]/a/text()')
    []