~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/webapp/admin/subject.py

Allow hiding of worksheets from students, and hiding of worksheet marks out of 5. Also add column for per-offering worksheet cutoff date, as yet unimplemented.

Show diffs side-by-side

added added

removed removed

Lines of Context:
308
308
 
309
309
        ctx['worksheets'], problems_total, problems_done = (
310
310
            ivle.worksheet.utils.create_list_of_fake_worksheets_and_stats(
311
 
                req.store, req.user, self.context))
 
311
                req.config, req.store, req.user, self.context))
312
312
 
313
313
        ctx['exercises_total'] = problems_total
314
314
        ctx['exercises_done'] = problems_done
385
385
    description = formencode.validators.UnicodeString(
386
386
        if_missing=None, not_empty=False)
387
387
    url = formencode.validators.URL(if_missing=None, not_empty=False)
 
388
    show_worksheet_marks = formencode.validators.StringBoolean(
 
389
        if_missing=False)
388
390
 
389
391
 
390
392
class OfferingAdminSchema(OfferingSchema):
425
427
                        self.context.semester.semester,
426
428
            'url': self.context.url,
427
429
            'description': self.context.description,
 
430
            'show_worksheet_marks': self.context.show_worksheet_marks,
428
431
            }
429
432
 
430
433
    def save_object(self, req, data):
433
436
            self.context.semester = data['semester']
434
437
        self.context.description = data['description']
435
438
        self.context.url = unicode(data['url']) if data['url'] else None
 
439
        self.context.show_worksheet_marks = data['show_worksheet_marks']
436
440
        return self.context
437
441
 
438
442
 
467
471
        new_offering.semester = data['semester']
468
472
        new_offering.description = data['description']
469
473
        new_offering.url = unicode(data['url']) if data['url'] else None
 
474
        new_offering.show_worksheet_marks = data['show_worksheet_marks']
470
475
 
471
476
        req.store.add(new_offering)
472
477
        return new_offering