This file is indexed.

/usr/share/pyshared/schooltool/lyceum/journal/ftests/journal.txt is in python-schooltool.lyceum.journal 2.1.0-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
Functional doctest for SchoolTool Journal
=========================================

Let's log in with the manager account:

    >>> from schooltool.lyceum.journal.ftests import printGradebookTable
    >>> manager = Browser('manager', 'schooltool')

Set up a basic school year:

    >>> manager.getLink('Manage').click()
    >>> manager.getLink('School Years').click()
    >>> manager.getLink('New School Year').click()
    >>> manager.getControl('Title').value = '2005'
    >>> manager.getControl('First day').value = '2005-09-01'
    >>> manager.getControl('Last day').value = '2006-07-31'
    >>> manager.getControl('Add').click()

Add some teachers:

    >>> from schooltool.basicperson.browser.ftests.setup import addPerson
    >>> addPerson('Pete', 'Teacher', username='pete', password='pwd', groups=['teachers'])
    >>> addPerson('John', 'Teacher', username='john', password='pwd', groups=['teachers'])

And some students:

    >>> addPerson('Frum', 'Student', username='frum', password='pwd', groups=['students'])
    >>> addPerson('Grum', 'Student', username='grum', password='pwd', groups=['students'])
    >>> addPerson('Bogon', 'Student', username='bogon', password='pwd', groups=['students'])

Add 2 Terms:

    >>> manager.getLink('Add a new term').click()
    >>> manager.getControl('Title').value = '2005 Fall 1'
    >>> manager.getControl('Start date').value = '2005-09-01'
    >>> manager.getControl('End date').value = '2005-10-31'
    >>> manager.getControl('Next').click()
    >>> manager.getControl('Saturday').click()
    >>> manager.getControl('Sunday').click()
    >>> manager.getControl('Add term').click()

    >>> manager.getLink('Add a new term').click()
    >>> manager.getControl('Title').value = '2005 Fall 2'
    >>> manager.getControl('Start date').value = '2005-11-01'
    >>> manager.getControl('End date').value = '2005-12-31'
    >>> manager.getControl('Next').click()
    >>> manager.getControl('Saturday').click()
    >>> manager.getControl('Sunday').click()
    >>> manager.getControl('Add term').click()

Timetable schema:

    >>> manager.getLink('2005').click()
    >>> manager.getLink('School Timetables').click()
    >>> manager.getLink('New Timetable').click()

    >>> manager.getControl('Next').click()
    >>> manager.getControl('Days of the week').click()
    >>> manager.getControl('Same time each day').click()
    >>> manager.getControl(name='field.times').value = '9:00-10:00\n10:30-11:30'
    >>> manager.getControl('Next').click()
    >>> manager.getControl('Have names').click()
    >>> manager.getControl(name='field.periods').value = 'A\nB'
    >>> manager.getControl('Next').click()
    >>> manager.getControl('Same').click()
    >>> manager.getControl('Next').click()
    >>> manager.getControl('No').click()

A couple of sections:

    >>> from schooltool.app.browser.ftests.setup import addSection
    >>> from schooltool.app.browser.ftests.setup import addCourse
    >>> addCourse("History", "2005")

    >>> addSection("History", "2005", "2005 Fall 1",
    ...            title="History (1a)",
    ...            instructors=['Pete'],
    ...            members=['Grum', 'Frum'])

    >>> addSection("History", "2005", "2005 Fall 1",
    ...            title="History (1b)",
    ...            instructors=['John'],
    ...            members=['Bogon'])

    >>> addSection("History", "2005", "2005 Fall 2",
    ...            title="History (1a)",
    ...            instructors=['Pete'],
    ...            members=['Grum', 'Frum'])

    >>> addSection("History", "2005", "2005 Fall 2",
    ...            title="History (1b)",
    ...            instructors=['John'],
    ...            members=['Bogon'])

Let's check that looking at a section journal without scheduling it
first works:

    >>> manager.getLink('2005').click()
    >>> manager.getLink('2005 Fall 1').click()
    >>> manager.getLink('Sections').click()
    >>> manager.getLink(url='sections/1').click()
    >>> manager.getLink('Journal').click()
    >>> print analyze.queryHTML('//div[@id="content-body"]', manager.contents)[0]
    <div id="content-body">
      <div>
        This section is not scheduled for any term, to use the journal you
        should add a timetable first.
      </div>
      <div>
        You can manage timetables for this section here:
        <a href="http://localhost/schoolyears/2005/2005-fall-1/sections/1/schedule">Schedule</a>
      </div>
    </div>

As we have the link to the list of timetables for this sections, we
might as well use it and schedule the section:

    >>> manager.getLink('Schedule').click()
    >>> manager.getLink('Add Timetable').click()
    >>> manager.getControl('Add').click()

Let's forget to set periods for the timetable and navigate straight to
the journal.

    >>> manager.getLink('2005').click()
    >>> manager.getLink('2005 Fall 1').click()
    >>> manager.getLink('Sections').click()
    >>> manager.getLink(url='sections/1').click()
    >>> manager.getLink('Journal').click()
    >>> print analyze.queryHTML('//div[@id="content-body"]', manager.contents)[0]
    <div id="content-body">
      <div>
        No periods have been assigned in timetables of this section.
      </div>
      <div>
        You can manage timetables for this section here:
        <a href="http://localhost/schoolyears/2005/2005-fall-1/sections/1/schedule">Schedule</a>
      </div>
    </div>

Follow the link and select some periods.

    >>> manager.getLink('Schedule').click()
    >>> manager.getLink('edit periods').click()
    >>> manager.getControl(name='period.1-.Period-').value = True
    >>> manager.getControl(name='period.1-.Period-2-').value = True
    >>> manager.getControl(name='period.2-.Period-').value = True
    >>> manager.getControl('Save').click()

Schedule the other section:

    >>> manager.getLink('2005').click()
    >>> manager.getLink('2005 Fall 1').click()
    >>> manager.getLink('Sections').click()
    >>> manager.getLink(url='sections/2').click()
    >>> manager.getLink('Schedule').click()
    >>> manager.getLink('Add Timetable').click()
    >>> manager.getControl('Add').click()
    >>> manager.getControl(name='period.1-.Period-').value = True
    >>> manager.getControl(name='period.1-.Period-2-').value = True
    >>> manager.getControl(name='period.2-.Period-').value = True
    >>> manager.getControl('Save').click()

Let's look at the other term that has not been scheduled yet:

    >>> manager.getLink('2005').click()
    >>> manager.getLink('2005 Fall 2').click()
    >>> manager.getLink('Sections').click()
    >>> manager.getLink(url='sections/1').click()
    >>> manager.getLink('Journal').click()
    >>> print analyze.queryHTML('//div[@id="content-body"]', manager.contents)[0]
    <div id="content-body">
      <div>
        This section is not scheduled for any term, to use the journal you
        should add a timetable first.
      </div>
      <div>
        You can manage timetables for this section here:
        <a href="http://localhost/schoolyears/2005/2005-fall-2/sections/1/schedule">Schedule</a>
      </div>
    </div>

Let's schedule the section for the second term:

    >>> manager.getLink('2005').click()
    >>> manager.getLink('2005 Fall 2').click()
    >>> manager.getLink('Sections').click()
    >>> manager.getLink(url='sections/1').click()
    >>> manager.getLink('Schedule').click()
    >>> manager.getLink('Add Timetable').click()
    >>> manager.getControl('Add').click()
    >>> manager.getControl(name='period.1-.Period-').value = True
    >>> manager.getControl(name='period.1-.Period-2-').value = True
    >>> manager.getControl(name='period.2-.Period-').value = True
    >>> manager.getControl('Save').click()

    >>> manager.getLink('2005').click()
    >>> manager.getLink('2005 Fall 2').click()
    >>> manager.getLink('Sections').click()
    >>> manager.getLink(url='sections/2').click()
    >>> manager.getLink('Schedule').click()
    >>> manager.getLink('Add Timetable').click()
    >>> manager.getControl('Add').click()
    >>> manager.getControl(name='period.1-.Period-').value = True
    >>> manager.getControl(name='period.1-.Period-2-').value = True
    >>> manager.getControl(name='period.2-.Period-').value = True
    >>> manager.getControl('Save').click()

Let's log in with the teacher account:

    >>> teacher = Browser()
    >>> teacher.handleErrors = False
    >>> teacher.open('http://localhost/')
    >>> teacher.getLink('Log In').click()
    >>> teacher.getControl('Username').value = 'pete'
    >>> teacher.getControl('Password').value = 'pwd'
    >>> teacher.getControl('Log in').click()

    >>> teacher.open('http://localhost/persons/frum/calendar/2005-09-06')
    >>> teacher.getLink('Journal', index=1).click()
    >>> printGradebookTable(teacher.contents)
    +-----+------------+-----------+---------+------+------+------+------+------+------+------+------+------+------+------+---------+----------+---------+
    | Nr. | First Name | Last Name | 06      | 06 B | 07 A | 13 A | 13 B | 14 A | 20 A | 20 B | 21 A | 27 A | 27 B | 28 A | Average | Absences | Tardies |
    +-----+------------+-----------+---------+------+------+------+------+------+------+------+------+------+------+------+---------+----------+---------+
    | 1   | Frum       | Student   | [_____] |      |      |      |      |      |      |      |      |      |      |      |         |          |         |
    | 2   | Grum       | Student   | [_____] |      |      |      |      |      |      |      |      |      |      |      |         |          |         |
    +-----+------------+-----------+---------+------+------+------+------+------+------+------+------+------+------+------+---------+----------+---------+

    >>> teacher.getLink('13').click()
    >>> printGradebookTable(teacher.contents)
    +-----+------------+-----------+------+------+------+---------+------+------+------+------+------+------+------+------+---------+----------+---------+
    | Nr. | First Name | Last Name | 06 A | 06 B | 07 A | 13      | 13 B | 14 A | 20 A | 20 B | 21 A | 27 A | 27 B | 28 A | Average | Absences | Tardies |
    +-----+------------+-----------+------+------+------+---------+------+------+------+------+------+------+------+------+---------+----------+---------+
    | 1   | Frum       | Student   |      |      |      | [_____] |      |      |      |      |      |      |      |      |         |          |         |
    | 2   | Grum       | Student   |      |      |      | [_____] |      |      |      |      |      |      |      |      |         |          |         |
    +-----+------------+-----------+------+------+------+---------+------+------+------+------+------+------+------+------+---------+----------+---------+

There is a legend explaining valid grade input:

   >>> print teacher.contents
   <BLANKLINE>
   ...
   <h3>Legend</h3>
   <table>
     <tr> <th colspan="2">Attendance / grade</th> </tr>
     <tr> <td>a</td> <td>Absent</td> </tr>
     <tr> <td>t</td> <td>Tardy</td> </tr>
     <tr> <td>1</td> <td></td> </tr>
     <tr> <td>2</td> <td></td> </tr>
     <tr> <td>3</td> <td></td> </tr>
     <tr> <td>4</td> <td></td> </tr>
     <tr> <td>5</td> <td></td> </tr>
     <tr> <td>6</td> <td></td> </tr>
     <tr> <td>7</td> <td></td> </tr>
     <tr> <td>8</td> <td></td> </tr>
     <tr> <td>9</td> <td></td> </tr>
     <tr> <td>10</td> <td></td> </tr>
   </table>
   ...

You can also access the journal through the section:

    >>> teacher.open('http://localhost/persons/frum')
    >>> teacher.getLink('History (1a)', index=1).click()
    >>> teacher.getLink('Journal', index=1).click()
    >>> teacher.getLink('December').click()
    >>> teacher.getLink('7').click()

    >>> cells = analyze.queryHTML('//table[@class="data"]//input[@type="text"]/@name', teacher.contents)
    >>> teacher.getControl(name=cells[0]).value = '10'
    >>> teacher.getControl(name=cells[1]).value = '5'
    >>> teacher.getControl('Update').click()
    >>> printGradebookTable(teacher.contents)
    +-----+------------+-----------+------+------+---------+------+------+------+------+------+------+------+------+------+---------+----------+---------+
    | Nr. | First Name | Last Name | 06 A | 06 B | 07      | 13 A | 13 B | 14 A | 20 A | 20 B | 21 A | 27 A | 27 B | 28 A | Average | Absences | Tardies |
    +-----+------------+-----------+------+------+---------+------+------+------+------+------+------+------+------+------+---------+----------+---------+
    | 1   | Frum       | Student   |      |      | [10___] |      |      |      |      |      |      |      |      |      | 10.000  |          |         |
    | 2   | Grum       | Student   |      |      | [5____] |      |      |      |      |      |      |      |      |      | 5.000   |          |         |
    +-----+------------+-----------+------+------+---------+------+------+------+------+------+------+------+------+------+---------+----------+---------+

Let's look around in the gradebook. If we click on another day, the
term and the month that is selected should be the same:

    >>> print analyze.queryHTML('//title', teacher.contents)[0]
    <title>
          Teacher, Pete -- History (1a)
          journal for December 2005</title>

    >>> teacher.getLink('27').click()

    >>> print analyze.queryHTML('//title', teacher.contents)[0]
    <title>
          Teacher, Pete -- History (1a)
          journal for December 2005</title>

Grades are still visible in table cells:

    >>> printGradebookTable(teacher.contents)
    +-----+------------+-----------+------+------+------+------+------+------+------+------+------+---------+------+------+---------+----------+---------+
    | Nr. | First Name | Last Name | 06 A | 06 B | 07 A | 13 A | 13 B | 14 A | 20 A | 20 B | 21 A | 27      | 27 B | 28 A | Average | Absences | Tardies |
    +-----+------------+-----------+------+------+------+------+------+------+------+------+------+---------+------+------+---------+----------+---------+
    | 1   | Frum       | Student   |      |      | 10   |      |      |      |      |      |      | [_____] |      |      | 10.000  |          |         |
    | 2   | Grum       | Student   |      |      | 5    |      |      |      |      |      |      | [_____] |      |      | 5.000   |          |         |
    +-----+------------+-----------+------+------+------+------+------+------+------+------+------+---------+------+------+---------+----------+---------+

Let's grade Grum once more:

    >>> cells = analyze.queryHTML('//table[@class="data"]//input[@type="text"]/@name', teacher.contents)
    >>> teacher.getControl(name=cells[1]).value = '8'
    >>> teacher.getControl('Update').click()
    >>> printGradebookTable(teacher.contents)
    +-----+------------+-----------+------+------+------+------+------+------+------+------+------+---------+------+------+---------+----------+---------+
    | Nr. | First Name | Last Name | 06 A | 06 B | 07 A | 13 A | 13 B | 14 A | 20 A | 20 B | 21 A | 27      | 27 B | 28 A | Average | Absences | Tardies |
    +-----+------------+-----------+------+------+------+------+------+------+------+------+------+---------+------+------+---------+----------+---------+
    | 1   | Frum       | Student   |      |      | 10   |      |      |      |      |      |      | [_____] |      |      | 10.000  |          |         |
    | 2   | Grum       | Student   |      |      | 5    |      |      |      |      |      |      | [8____] |      |      | 6.500   |          |         |
    +-----+------------+-----------+------+------+------+------+------+------+------+------+------+---------+------+------+---------+----------+---------+

Let's switch to another month now:

    >>> teacher.getLink('November').click()

We got a different month:

    >>> print analyze.queryHTML('//title', teacher.contents)[0]
    <title>
          Teacher, Pete -- History (1a)
          journal for November 2005</title>

There are no grades in the table:

    >>> printGradebookTable(teacher.contents)
    +-----+------------+-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+---------+----------+---------+
    | Nr. | First Name | Last Name | 01 A | 01 B | 02 A | 08 A | 08 B | 09 A | 15 A | 15 B | 16 A | 22 A | 22 B | 23 A | 29 A | 29 B | 30 A | Average | Absences | Tardies |
    +-----+------------+-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+---------+----------+---------+
    | 1   | Frum       | Student   |      |      |      |      |      |      |      |      |      |      |      |      |      |      |      | 10.000  |          |         |
    | 2   | Grum       | Student   |      |      |      |      |      |      |      |      |      |      |      |      |      |      |      | 6.500   |          |         |
    +-----+------------+-----------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+---------+----------+---------+

Let's select a day:

    >>> teacher.getLink('16').click()

Month and semester still stay the same:

    >>> print analyze.queryHTML('//title', teacher.contents)[0]
    <title>
          Teacher, Pete -- History (1a)
          journal for November 2005</title>

But we get 2 cells with input boxes in them for entering of grades:

    >>> printGradebookTable(teacher.contents)
    +-----+------------+-----------+------+------+------+------+------+------+------+------+---------+------+------+------+------+------+------+---------+----------+---------+
    | Nr. | First Name | Last Name | 01 A | 01 B | 02 A | 08 A | 08 B | 09 A | 15 A | 15 B | 16      | 22 A | 22 B | 23 A | 29 A | 29 B | 30 A | Average | Absences | Tardies |
    +-----+------------+-----------+------+------+------+------+------+------+------+------+---------+------+------+------+------+------+------+---------+----------+---------+
    | 1   | Frum       | Student   |      |      |      |      |      |      |      |      | [_____] |      |      |      |      |      |      | 10.000  |          |         |
    | 2   | Grum       | Student   |      |      |      |      |      |      |      |      | [_____] |      |      |      |      |      |      | 6.500   |          |         |
    +-----+------------+-----------+------+------+------+------+------+------+------+------+---------+------+------+------+------+------+------+---------+----------+---------+

If we click Update, everything stays the same:

    >>> teacher.getControl('Update').click()
    >>> print analyze.queryHTML('//title', teacher.contents)[0]
    <title>
          Teacher, Pete -- History (1a)
          journal for November 2005</title>

If we select a different term, the first month in the term should get
activated:

    >>> teacher.open('http://localhost/persons/frum')
    >>> teacher.getLink('History (1a)').click()
    >>> teacher.getLink('Journal', index=1).click()

    >>> print analyze.queryHTML('//title', teacher.contents)[0]
    <title>
          Teacher, Pete -- History (1a)
          journal for September 2005</title>

Choosing some day should not change neither the term, nor month:

    >>> teacher.getLink('13').click()

    >>> print analyze.queryHTML('//title', teacher.contents)[0]
    <title>
          Teacher, Pete -- History (1a)
          journal for September 2005</title>

Month switches:

    >>> teacher.getLink('October').click()

    >>> print analyze.queryHTML('//title', teacher.contents)[0]
    <title>
          Teacher, Pete -- History (1a)
          journal for October 2005</title>

Updating should work too:

    >>> teacher.getControl('Update').click()

    >>> print analyze.queryHTML('//title', teacher.contents)[0]
    <title>
          Teacher, Pete -- History (1a)
          journal for October 2005</title>

Now let's look at the gradebook of the person - we can see his grades:

    >>> teacher.open('http://localhost/persons/frum/gradebook.html')
    >>> teacher.getLink('December').click()
    >>> printGradebookTable(teacher.contents)
    +---------+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+---------+
    | Title   | 01 | 02 | 03 | 04 | 05 | 06 | 07 | 08 | 09 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | Average |
    +---------+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+---------+
    | History |    |    |    |    |    |    | 10 |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    |    | 10.000  |
    +---------+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+---------+