/usr/lib/python2.7/dist-packages/schooltool/gradebook/browser/ftests/due_date_filter.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 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 | Due date filter for activities
------------------------------
Import helper to print the gradebook:
>>> from schooltool.gradebook.browser.ftests import printGradebook
Log in as manager:
>>> manager = Browser('manager', 'schooltool')
Set the date for the tests to June 1st:
>>> manager.open('http://localhost/time')
>>> manager.getControl('Today').value = "2011-06-01"
>>> manager.getControl('Apply').click()
>>> manager.printQuery('//div[@class="summary"]/text()')
Data successfully updated.
Add a schoolyear:
>>> from schooltool.app.browser.ftests import setup
>>> setup.addSchoolYear('2011', '2011-01-01', '2011-12-31')
Add two terms to the schoolyear:
>>> setup.addTerm('Semester One', '2011-01-01', '2011-06-30', '2011')
>>> setup.addTerm('Second Semester', '2011-07-01', '2011-12-31', '2011')
Set up three courses:
>>> setup.addCourse('Soccer', '2011')
>>> setup.addCourse('Golf', '2011')
>>> setup.addCourse('Tennis', '2011')
Set up persons:
>>> from schooltool.basicperson.browser.ftests.setup import addPerson
>>> addPerson('Mario', 'Tejada', 'mario', 'pwd', browser=manager)
>>> addPerson('Camila', 'Cerna', 'camila', 'pwd', browser=manager)
>>> addPerson('Nestor', 'Guzman', 'nestor', 'pwd', browser=manager)
>>> addPerson('William', 'Mejia', 'william', 'pwd', browser=manager)
Set up four sections with instructor and students, two in the first
semester and two in the second:
>>> setup.addSection('Soccer', '2011', 'Semester One',
... instructors=['William'],
... members=['Mario', 'Camila', 'Nestor'])
>>> setup.addSection('Golf', '2011', 'Semester One',
... instructors=['William'],
... members=['Mario', 'Camila', 'Nestor'])
>>> setup.addSection('Tennis', '2011', 'Second Semester',
... instructors=['William'],
... members=['Mario', 'Camila', 'Nestor'])
>>> setup.addSection('Golf', '2011', 'Second Semester',
... instructors=['William'],
... members=['Mario', 'Camila', 'Nestor'])
Log in as teacher:
>>> teacher = Browser('william', 'pwd')
Go to his gradebook:
>>> teacher.getLink('Gradebook').click()
Check we are in the Soccer section of the first semester:
>>> teacher.printQuery('//select[@name="currentTerm"]/option/text()')
2011 / Semester One
2011 / Second Semester
>>> teacher.printQuery('//select[@name="currentTerm"]/option[@selected="selected"]/text()')
2011 / Semester One
>>> teacher.printQuery('//select[@name="currentSection"]/option/text()')
Soccer - Soccer (1)
Golf - Golf (2)
>>> teacher.printQuery('//select[@name="currentSection"]/option[@selected="selected"]/text()')
Soccer - Soccer (1)
Add a homework activity with due date on February 11th:
>>> teacher.getLink('New Activity').click()
>>> teacher.getControl('Title').value = 'Get a ball'
>>> teacher.getControl('Label').value = 'BALL'
>>> teacher.getControl('Due Date').value = '2011-02-11'
>>> teacher.getControl('Category').displayValue = ['Homework']
>>> teacher.getControl('Maximum').value = '10'
>>> teacher.getControl('Add').click()
Grade this homework:
>>> teacher.getLink('BALL').click()
>>> teacher.getControl('Camila Cerna').value = '7'
>>> teacher.getControl('Nestor Guzman').value = '10'
>>> teacher.getControl('Mario Tejada').value = '8'
>>> teacher.getControl('Save').click()
>>> printGradebook(teacher.contents)
+----------+
| *Sheet1* |
+----------+
+---------------+-------+--------+---------+
| Name | Total | Ave. | BALL |
+---------------+-------+--------+---------+
| Camila Cerna | 7.0 | 70.0% | [7____] |
| Nestor Guzman | 10.0 | 100.0% | [10___] |
| Mario Tejada | 8.0 | 80.0% | [8____] |
+---------------+-------+--------+---------+
Add a second homework with due date on April 4th and grade it:
>>> teacher.getLink('New Activity').click()
>>> teacher.getControl('Title').value = 'Get a team'
>>> teacher.getControl('Label').value = 'TEAM'
>>> teacher.getControl('Due Date').value = '2011-04-04'
>>> teacher.getControl('Category').displayValue = ['Homework']
>>> teacher.getControl('Maximum').value = '10'
>>> teacher.getControl('Add').click()
>>> teacher.getLink('TEAM').click()
>>> teacher.getControl('Camila Cerna').value = '10'
>>> teacher.getControl('Nestor Guzman').value = '6'
>>> teacher.getControl('Mario Tejada').value = '8'
>>> teacher.getControl('Save').click()
>>> printGradebook(teacher.contents)
+----------+
| *Sheet1* |
+----------+
+---------------+-------+-------+---------+---------+
| Name | Total | Ave. | BALL | TEAM |
+---------------+-------+-------+---------+---------+
| Camila Cerna | 17.0 | 85.0% | [7____] | [10___] |
| Nestor Guzman | 16.0 | 80.0% | [10___] | [6____] |
| Mario Tejada | 16.0 | 80.0% | [8____] | [8____] |
+---------------+-------+-------+---------+---------+
And a third one with due date on April 29th:
>>> teacher.getLink('New Activity').click()
>>> teacher.getControl('Title').value = 'Play a game'
>>> teacher.getControl('Label').value = 'GAME'
>>> teacher.getControl('Due Date').value = '2011-04-29'
>>> teacher.getControl('Category').displayValue = ['Homework']
>>> teacher.getControl('Maximum').value = '10'
>>> teacher.getControl('Add').click()
>>> teacher.getLink('GAME').click()
>>> teacher.getControl('Camila Cerna').value = '9'
>>> teacher.getControl('Nestor Guzman').value = '9'
>>> teacher.getControl('Mario Tejada').value = '9'
>>> teacher.getControl('Save').click()
>>> printGradebook(teacher.contents)
+----------+
| *Sheet1* |
+----------+
+---------------+-------+-------+---------+---------+---------+
| Name | Total | Ave. | BALL | TEAM | GAME |
+---------------+-------+-------+---------+---------+---------+
| Camila Cerna | 26.0 | 86.7% | [7____] | [10___] | [9____] |
| Nestor Guzman | 25.0 | 83.3% | [10___] | [6____] | [9____] |
| Mario Tejada | 25.0 | 83.3% | [8____] | [8____] | [9____] |
+---------------+-------+-------+---------+---------+---------+
Now, let's add an exam with due date on May 20th:
>>> teacher.getLink('New Activity').click()
>>> teacher.getControl('Title').value = 'Score a goal'
>>> teacher.getControl('Label').value = 'GOAL'
>>> teacher.getControl('Due Date').value = '2011-05-20'
>>> teacher.getControl('Category').displayValue = ['Exam']
>>> teacher.getControl('Maximum').value = '10'
>>> teacher.getControl('Add').click()
>>> teacher.getLink('GOAL').click()
>>> teacher.getControl('Camila Cerna').value = '10'
>>> teacher.getControl('Nestor Guzman').value = '5'
>>> teacher.getControl('Mario Tejada').value = '10'
>>> teacher.getControl('Save').click()
>>> printGradebook(teacher.contents)
+----------+
| *Sheet1* |
+----------+
+---------------+-------+-------+---------+---------+---------+---------+
| Name | Total | Ave. | BALL | TEAM | GAME | GOAL |
+---------------+-------+-------+---------+---------+---------+---------+
| Camila Cerna | 36.0 | 90.0% | [7____] | [10___] | [9____] | [10___] |
| Nestor Guzman | 30.0 | 75.0% | [10___] | [6____] | [9____] | [5____] |
| Mario Tejada | 35.0 | 87.5% | [8____] | [8____] | [9____] | [10___] |
+---------------+-------+-------+---------+---------+---------+---------+
And go grade a single student:
>>> teacher.getLink('>', index=0).click()
>>> url = teacher.url
>>> teacher.printQuery('//h3/text()')
Enter grades for Camila Cerna
To see all the activities available to be graded:
>>> teacher.printQuery('//fieldset//label/span/text()')
Get a ball (10)
Get a team (10)
Play a game (10)
Score a goal (10)
and change one:
>>> teacher.getControl('Get a ball').value = ''
>>> teacher.getControl('Apply').click()
>>> printGradebook(teacher.contents)
+----------+
| *Sheet1* |
+----------+
+---------------+-------+-------+---------+---------+---------+---------+
| Name | Total | Ave. | BALL | TEAM | GAME | GOAL |
+---------------+-------+-------+---------+---------+---------+---------+
| Camila Cerna | 29.0 | 96.7% | [_____] | [10___] | [9____] | [10___] |
| Nestor Guzman | 30.0 | 75.0% | [10___] | [6____] | [9____] | [5____] |
| Mario Tejada | 35.0 | 87.5% | [8____] | [8____] | [9____] | [10___] |
+---------------+-------+-------+---------+---------+---------+---------+
Let's check the 'view.html' view for the student (XXX: which btw has no way
to be accessed, no links, no button, nothing!):
>>> teacher.open(url + '/view.html')
>>> teacher.printQuery('//h1/text()')
Sheet1 for Camila Cerna in Soccer - Soccer (1)
>>> teacher.printQuery('//div[@class="info-block"]/h3/text()')
Get a ball
Get a team
Play a game
Score a goal
Now, let's test the due date widget. The widget has a checkbox and a
dropdown with numbers from 1-9 representing past weeks to filter the
activities. By default the weeks dropdown is set to 9:
>>> teacher.getLink('Gradebook').click()
>>> teacher.printQuery('//input[@name="due_date:list"]')
<input type="checkbox" name="due_date:list" />
>>> teacher.printQuery('//select[@name="num_weeks"]/option/text()')
1
2
3
4
5
6
7
8
9
>>> teacher.printQuery('//select[@name="num_weeks"]/option[@selected="selected"]/text()')
9
Let's mark the checkbox and hit the 'Save' button to filter the
activities, showing only those with due date in the past 9 weeks:
>>> teacher.getControl(name='due_date:list').value = True
>>> teacher.getControl('Save').click()
>>> teacher.printQuery('//input[@name="due_date:list"]')
<input type="checkbox" name="due_date:list" checked="checked" />
>>> printGradebook(teacher.contents)
+----------+
| *Sheet1* |
+----------+
+---------------+-------+-------+---------+---------+---------+
| Name | Total | Ave. | TEAM | GAME | GOAL |
+---------------+-------+-------+---------+---------+---------+
| Camila Cerna | 29.0 | 96.7% | [10___] | [9____] | [10___] |
| Nestor Guzman | 30.0 | 75.0% | [6____] | [9____] | [5____] |
| Mario Tejada | 35.0 | 87.5% | [8____] | [9____] | [10___] |
+---------------+-------+-------+---------+---------+---------+
Notice how the 'Get a ball (BALL)' activity is filtered out, but the
Total and Average values stay the same.
If we get back to grade a single student:
>>> teacher.getLink('>', index=0).click()
>>> teacher.printQuery('//h3/text()')
Enter grades for Camila Cerna
We see the filter works there too:
>>> teacher.printQuery('//fieldset//label/span/text()')
Get a team (10)
Play a game (10)
Score a goal (10)
Let's check again the 'view.html' view for the student and see the
filter works there too:
>>> url = teacher.url
>>> teacher.open(url + '/view.html')
>>> teacher.printQuery('//h1/text()')
Sheet1 for Camila Cerna in Soccer - Soccer (1)
>>> teacher.printQuery('//div[@class="info-block"]/h3/text()')
Get a team
Play a game
Score a goal
Let's change the dropdown to show only activities with due date in the
past two weeks:
>>> teacher.getLink('Gradebook').click()
>>> teacher.getControl(name='num_weeks').displayValue = ['2']
>>> teacher.getControl('Save').click()
>>> teacher.printQuery('//input[@name="due_date:list"]')
<input type="checkbox" name="due_date:list" checked="checked" />
>>> teacher.printQuery('//select[@name="num_weeks"]/option[@selected="selected"]/text()')
2
>>> printGradebook(teacher.contents)
+----------+
| *Sheet1* |
+----------+
+---------------+-------+-------+---------+
| Name | Total | Ave. | GOAL |
+---------------+-------+-------+---------+
| Camila Cerna | 29.0 | 96.7% | [10___] |
| Nestor Guzman | 30.0 | 75.0% | [5____] |
| Mario Tejada | 35.0 | 87.5% | [10___] |
+---------------+-------+-------+---------+
And if we change the dropdown to one week, all the activities are
filtered out:
>>> teacher.getControl(name='num_weeks').displayValue = ['1']
>>> teacher.getControl('Save').click()
>>> teacher.printQuery('//input[@name="due_date:list"]')
<input type="checkbox" name="due_date:list" checked="checked" />
>>> teacher.printQuery('//select[@name="num_weeks"]/option[@selected="selected"]/text()')
1
>>> printGradebook(teacher.contents)
+----------+
| *Sheet1* |
+----------+
+---------------+-------+-------+
| Name | Total | Ave. |
+---------------+-------+-------+
| Camila Cerna | 29.0 | 96.7% |
| Nestor Guzman | 30.0 | 75.0% |
| Mario Tejada | 35.0 | 87.5% |
+---------------+-------+-------+
Let's change the due date for the GOAL activity to May 30th:
>>> teacher.getLink('Manage Worksheet').click()
>>> teacher.getLink('Score a goal').click()
>>> teacher.getControl('Due Date').value = '2011-05-30'
>>> teacher.getControl('Apply').click()
>>> teacher.getLink('Return to Gradebook').click()
And now the activity is not filtered out because its due date is in
the past week:
>>> printGradebook(teacher.contents)
+----------+
| *Sheet1* |
+----------+
+---------------+-------+-------+---------+
| Name | Total | Ave. | GOAL |
+---------------+-------+-------+---------+
| Camila Cerna | 29.0 | 96.7% | [10___] |
| Nestor Guzman | 30.0 | 75.0% | [5____] |
| Mario Tejada | 35.0 | 87.5% | [10___] |
+---------------+-------+-------+---------+
To show all the activities again, we unmark the checkbox:
>>> teacher.getControl(name='due_date:list').value = False
>>> teacher.getControl('Save').click()
>>> teacher.printQuery('//input[@name="due_date:list"]')
<input type="checkbox" name="due_date:list" />
>>> teacher.printQuery('//select[@name="num_weeks"]/option[@selected="selected"]/text()')
1
>>> printGradebook(teacher.contents)
+----------+
| *Sheet1* |
+----------+
+---------------+-------+-------+---------+---------+---------+---------+
| Name | Total | Ave. | BALL | TEAM | GAME | GOAL |
+---------------+-------+-------+---------+---------+---------+---------+
| Camila Cerna | 29.0 | 96.7% | [_____] | [10___] | [9____] | [10___] |
| Nestor Guzman | 30.0 | 75.0% | [10___] | [6____] | [9____] | [5____] |
| Mario Tejada | 35.0 | 87.5% | [8____] | [8____] | [9____] | [10___] |
+---------------+-------+-------+---------+---------+---------+---------+
Filter keeps its value through term, section and worksheet changes (BUG?)
-------------------------------------------------------------------------
The checkbox and dropdown values of the due date filter widget are
stored globally for the person. This means that both values are
applied to any term, section and worksheet that the user visits.
Let's unmark the checkbox and change the dropdown value to 9 weeks:
>>> teacher.getControl(name='due_date:list').value = False
>>> teacher.getControl(name='num_weeks').displayValue = ['9']
>>> teacher.getControl('Save').click()
>>> teacher.printQuery('//input[@name="due_date:list"]')
<input type="checkbox" name="due_date:list" />
>>> teacher.printQuery('//select[@name="num_weeks"]/option[@selected="selected"]/text()')
9
All the activities are shown in the default worksheet of the Soccer
section of the first semester:
>>> printGradebook(teacher.contents)
+----------+
| *Sheet1* |
+----------+
+---------------+-------+-------+---------+---------+---------+---------+
| Name | Total | Ave. | BALL | TEAM | GAME | GOAL |
+---------------+-------+-------+---------+---------+---------+---------+
| Camila Cerna | 29.0 | 96.7% | [_____] | [10___] | [9____] | [10___] |
| Nestor Guzman | 30.0 | 75.0% | [10___] | [6____] | [9____] | [5____] |
| Mario Tejada | 35.0 | 87.5% | [8____] | [8____] | [9____] | [10___] |
+---------------+-------+-------+---------+---------+---------+---------+
We'll add a second worksheet with two activities, one with due date on
April 11th and the other on May 27th:
>>> teacher.getLink('Worksheets').click()
>>> teacher.getLink('New Worksheet').click()
>>> teacher.getControl('Title').value = 'Second WS'
>>> teacher.getControl('Add').click()
>>> teacher.getLink('Second WS').click()
>>> teacher.getLink('New Activity').click()
>>> teacher.getControl('Title').value = 'Win a game'
>>> teacher.getControl('Label').value = 'WIN'
>>> teacher.getControl('Due Date').value = '2011-04-11'
>>> teacher.getControl('Add').click()
>>> teacher.getLink('New Activity').click()
>>> teacher.getControl('Title').value = 'Make a save'
>>> teacher.getControl('Label').value = 'SAVE'
>>> teacher.getControl('Due Date').value = '2011-05-27'
>>> teacher.getControl('Add').click()
All the activites are shown in the second worksheet:
>>> printGradebook(teacher.contents)
+--------+-------------+
| Sheet1 | *Second WS* |
+--------+-------------+
+---------------+-------+------+---------+---------+
| Name | Total | Ave. | WIN | SAVE |
+---------------+-------+------+---------+---------+
| Camila Cerna | 0.0 | N/A | [_____] | [_____] |
| Nestor Guzman | 0.0 | N/A | [_____] | [_____] |
| Mario Tejada | 0.0 | N/A | [_____] | [_____] |
+---------------+-------+------+---------+---------+
Let's apply the due filter in the second worksheet:
>>> teacher.getControl(name='due_date:list').value = True
>>> teacher.getControl(name='num_weeks').displayValue = ['1']
>>> teacher.getControl('Save').click()
>>> teacher.printQuery('//input[@name="due_date:list"]')
<input type="checkbox" name="due_date:list" checked="checked" />
>>> teacher.printQuery('//select[@name="num_weeks"]/option[@selected="selected"]/text()')
1
>>> printGradebook(teacher.contents)
+--------+-------------+
| Sheet1 | *Second WS* |
+--------+-------------+
+---------------+-------+------+---------+
| Name | Total | Ave. | SAVE |
+---------------+-------+------+---------+
| Camila Cerna | 0.0 | N/A | [_____] |
| Nestor Guzman | 0.0 | N/A | [_____] |
| Mario Tejada | 0.0 | N/A | [_____] |
+---------------+-------+------+---------+
If we change back to the first worksheet, the checkbox is marked and
the dropdown has its new value, so the old filter is also applied to
this worksheet:
>>> teacher.getLink('Sheet1').click()
>>> teacher.printQuery('//input[@name="due_date:list"]')
<input type="checkbox" name="due_date:list" checked="checked" />
>>> teacher.printQuery('//select[@name="num_weeks"]/option[@selected="selected"]/text()')
1
>>> printGradebook(teacher.contents)
+----------+-----------+
| *Sheet1* | Second WS |
+----------+-----------+
+---------------+-------+-------+---------+
| Name | Total | Ave. | GOAL |
+---------------+-------+-------+---------+
| Camila Cerna | 29.0 | 96.7% | [10___] |
| Nestor Guzman | 30.0 | 75.0% | [5____] |
| Mario Tejada | 35.0 | 87.5% | [10___] |
+---------------+-------+-------+---------+
If we change to another section, the old filter keeps its values:
>>> teacher.getControl(name='currentSection').displayValue = ['Golf - Golf (2)']
>>> teacher.getForm().submit()
>>> teacher.printQuery('//select[@name="currentTerm"]/option[@selected="selected"]/text()')
2011 / Semester One
>>> teacher.printQuery('//select[@name="currentSection"]/option[@selected="selected"]/text()')
Golf - Golf (2)
>>> teacher.printQuery('//input[@name="due_date:list"]')
<input type="checkbox" name="due_date:list" checked="checked" />
>>> teacher.printQuery('//select[@name="num_weeks"]/option[@selected="selected"]/text()')
1
>>> printGradebook(teacher.contents)
+----------+
| *Sheet1* |
+----------+
+---------------+-------+------+
| Name | Total | Ave. |
+---------------+-------+------+
| Camila Cerna | 0.0 | N/A |
| Nestor Guzman | 0.0 | N/A |
| Mario Tejada | 0.0 | N/A |
+---------------+-------+------+
Or to another term:
>>> teacher.getControl(name='currentTerm').displayValue = ['2011 / Second Semester']
>>> teacher.getForm().submit()
>>> teacher.printQuery('//select[@name="currentTerm"]/option[@selected="selected"]/text()')
2011 / Second Semester
>>> teacher.printQuery('//select[@name="currentSection"]/option[@selected="selected"]/text()')
Tennis - Tennis (1)
>>> teacher.printQuery('//input[@name="due_date:list"]')
<input type="checkbox" name="due_date:list" checked="checked" />
>>> teacher.printQuery('//select[@name="num_weeks"]/option[@selected="selected"]/text()')
1
>>> printGradebook(teacher.contents)
+----------+
| *Sheet1* |
+----------+
+---------------+-------+------+
| Name | Total | Ave. |
+---------------+-------+------+
| Camila Cerna | 0.0 | N/A |
| Nestor Guzman | 0.0 | N/A |
| Mario Tejada | 0.0 | N/A |
+---------------+-------+------+
|