This file is indexed.

/usr/lib/python2.7/dist-packages/schooltool/gradebook/browser/ftests/absences_tardies.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
Absences and Tardies Gradebook Columns
--------------------------------------

If the journal plug-in is installed, we will provide the user with the option
of including the absences and/or tardies for the students as columns next to
total and average.  By default they will be hidden but can be easily
enabled in the column preferences view.

Import helper to print the gradebook:

    >>> from schooltool.gradebook.browser.ftests import printGradebook

Log in as manager:

    >>> manager = Browser('manager', 'schooltool')

Now, set up a school year (2005-2006) with two terms (Fall and
Spring):

    >>> from schooltool.app.browser.ftests import setup
    >>> setup.setUpBasicSchool()

Set up one course:

    >>> setup.addCourse('Physics I', '2005-2006')

Set up persons:

    >>> from schooltool.basicperson.browser.ftests.setup import addPerson
    >>> addPerson('Claudia', 'Richter', 'claudia', 'pwd', browser=manager)
    >>> addPerson('Stephan', 'Richter', 'stephan', 'pwd', browser=manager)

Set up a section with instructor and students for the Fall:

    >>> setup.addSection('Physics I', '2005-2006', 'Fall',
    ...                  instructors=['Stephan'],
    ...                  members=['Claudia'])

Set up a timetable:

    >>> manager.getLink('2005-2006').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 = \
    ...     '8:00-9:00 \n 9:00-10:00 \n 10:00-11:00'
    >>> manager.getControl('Next').click()
    >>> manager.getControl('Have names').click()
    >>> manager.getControl(name='field.periods').value = \
    ...     'First period \n Second period \n Third period'
    >>> manager.getControl('Next').click()
    >>> manager.getControl('Same').click()
    >>> manager.getControl('Next').click()
    >>> manager.getControl('No').click()

Define a schedule for our section:

    >>> manager.getLink('2005-2006').click()
    >>> manager.getLink('Fall').click()
    >>> manager.getLink('Sections').click()
    >>> manager.getLink('Physics I (1)').click()
    >>> manager.getLink('Schedule').click()
    >>> manager.getLink('Add Timetable').click()
    >>> manager.getControl('Add').click()
    >>> manager.getControl('First period', index=0).click()
    >>> manager.getControl('First period', index=1).click()
    >>> manager.getControl('First period', index=2).click()
    >>> manager.getControl('First period', index=3).click()
    >>> manager.getControl('First period', index=4).click()
    >>> manager.getControl('Save').click()

Log in as teacher:

    >>> stephan = Browser('stephan', 'pwd')

By default the absences and tardies coluns are hidden:

    >>> stephan.getLink('Gradebook').click()
    >>> printGradebook(stephan.contents)
    +----------+
    | *Sheet1* |
    +----------+
    +-----------------+-------+------+
    | Name            | Total | Ave. |
    +-----------------+-------+------+
    | Claudia Richter | 0.0   | N/A  |
    +-----------------+-------+------+

We'll go unhide the columns in the prefernces view.

    >>> stephan.getLink('Preferences').click()
    >>> stephan.getControl(name='hide_absences').value = False
    >>> stephan.getControl(name='hide_tardies').value = False
    >>> stephan.getControl('Update').click()

Now the columns appear in the gradebook.  There is no attendence data yet, so
the values are both 0.

    >>> printGradebook(stephan.contents)
    +----------+
    | *Sheet1* |
    +----------+
    +-----------------+------+------+-------+------+
    | Name            | Abs. | Trd. | Total | Ave. |
    +-----------------+------+------+-------+------+
    | Claudia Richter | 0    | 0    | 0.0   | N/A  |
    +-----------------+------+------+-------+------+

Let's add some attendance data for the student.  This will include some
absences and tardies as well as present grades:

    >>> stephan.getLink('Journal').click()
    >>> stephan.getLink('Physics I (1)').click()
    >>> stephan.getLink('Claudia').click()
    >>> input_names = stephan.queryHTML('//input[@type="text"]/@name')
    >>> stephan.getControl(name=input_names[0]).value = '9'
    >>> stephan.getControl(name=input_names[1]).value = '8'
    >>> stephan.getControl(name=input_names[2]).value = 't'
    >>> stephan.getControl(name=input_names[3]).value = 'a'
    >>> stephan.getControl(name=input_names[4]).value = 'a'
    >>> stephan.getControl('Update').click()

Now the gradebook shows the absences and tardies, the present grades being
left out of the calculation:

    >>> stephan.getLink('Gradebook').click()
    >>> printGradebook(stephan.contents)
    +----------+
    | *Sheet1* |
    +----------+
    +-----------------+------+------+-------+------+
    | Name            | Abs. | Trd. | Total | Ave. |
    +-----------------+------+------+-------+------+
    | Claudia Richter | 2    | 1    | 0.0   | N/A  |
    +-----------------+------+------+-------+------+

As with the total and average columns, we can change the label.

    >>> stephan.getLink('Preferences').click()
    >>> stephan.getControl(name='label_absences').value = 'Absences'
    >>> stephan.getControl(name='label_tardies').value = 'Tardies'
    >>> stephan.getControl('Update').click()
    >>> printGradebook(stephan.contents)
    +----------+
    | *Sheet1* |
    +----------+
    +-----------------+----------+---------+-------+------+
    | Name            | Absences | Tardies | Total | Ave. |
    +-----------------+----------+---------+-------+------+
    | Claudia Richter | 2        | 1       | 0.0   | N/A  |
    +-----------------+----------+---------+-------+------+

To make sure the gradebook pdf works with the new columns, we will need the
special xml browser class.

    >>> from schooltool.testing.analyze import etree, to_string
    >>> class XMLBrowser(Browser):
    ...     def queryXML(self, xpath):
    ...         doc = etree.XML(self.contents)
    ...         result = [to_string(node) for node in doc.xpath(xpath)]
    ...         return result
    ...     def printXMLQuery(self, xpath):
    ...         for result in self.queryXML(xpath):
    ...             print result

    >>> stephan = XMLBrowser('stephan', 'pwd')

We'll download the pdf and test its data.

    >>> stephan.getLink('Gradebook').click()
    >>> stephan.getLink('Download PDF').click()
    >>> stephan.printXMLQuery('//blockTable[2]/tr/td[1]/para/text()')
    Student
    Claudia Richter

    >>> stephan.printXMLQuery('//blockTable[2]/tr/td[2]/para')
    <para style="grid_heading">Absences</para>
    <para style="cell">2</para>

    >>> stephan.printXMLQuery('//blockTable[2]/tr/td[3]/para')
    <para style="grid_heading">Tardies</para>
    <para style="cell">1</para>

    >>> stephan.printXMLQuery('//blockTable[2]/tr/td[4]/para')
    <para style="grid_heading">Total</para>
    <para style="cell">0.0</para>

    >>> stephan.printXMLQuery('//blockTable[2]/tr/td[5]/para')
    <para style="grid_heading">Ave.</para>
    <para style="cell">N/A</para>