<commit_before>/** PrettyView for an period. */
Ext.define('devilry.administrator.period.PrettyView', {
    extend: 'devilry.administrator.PrettyView',
    alias: 'widget.administrator_periodprettyview',

    bodyTpl: Ext.create('Ext.XTemplate',
        '<div class="section">',
        '   <tpl if="is_old">',
        '       <div class="section warning">',
        '           <h1>Expired period</h1>',
        '           <p>',
        '               This period was active from <strong>{start_time:date}</strong> to ',
        '               <strong>{end_time:date}</strong>. Examiners do not have ',
        '               access to any data related to the period, including the ',
        '               feedback they have given to students. ',
        '               Students can still view all their deliveries and feedback.',
        '           </p>',
        '       </div>',
        '   </tpl>',
        '   <tpl if="starttime_in_future">',
        '       <div class="section warning">',
        '           <h1>In the future</h1>',
        '           <p>',
        '               This period has not yet started. Students and examiners ',
        '               can not access the period until its <strong>start time</strong>, which is ',
        '               <strong>{start_time:date}</strong>',
        '           </p>',
        '       </div>',
        '   </tpl>',
        '   <tpl if="is_active">',
        '       <div class="section ok">',
        '           <h1>Active</h1>',
        '           <p>',
        '               This period is currently active. It started <strong>{start_time:date}</strong> ',
        '               and it expires <strong>{end_time:date}</strong>. When the period expires, examiners ',
        '               will not have access to any data related to the period, including the ',
        '               feedback they have given to students.',
        '           </p>',
        '       </div>',
        '   </tpl>',
        '</div>'
    ),

    getExtraBodyData: function(record) {
        var is_old = record.data.end_time < Ext.Date.now();
        var starttime_in_future = record.data.start_time > Ext.Date.now();
        return {
            is_old: is_old,
            starttime_in_future: starttime_in_future,
            is_active: (!is_old && !starttime_in_future)
        };
    }
});<commit_msg>apps.administrator...period.PrettyView: Link to period overview.<commit_after>/** PrettyView for an period. */
Ext.define('devilry.administrator.period.PrettyView', {
    extend: 'devilry.administrator.PrettyView',
    alias: 'widget.administrator_periodprettyview',

    bodyTpl: Ext.create('Ext.XTemplate',
        '<div class="section">',
        '   <tpl if="is_old">',
        '       <div class="section warning">',
        '           <h1>Expired period</h1>',
        '           <p>',
        '               This period was active from <strong>{start_time:date}</strong> to ',
        '               <strong>{end_time:date}</strong>. Examiners do not have ',
        '               access to any data related to the period, including the ',
        '               feedback they have given to students. ',
        '               Students can still view all their deliveries and feedback.',
        '           </p>',
        '       </div>',
        '   </tpl>',
        '   <tpl if="starttime_in_future">',
        '       <div class="section warning">',
        '           <h1>In the future</h1>',
        '           <p>',
        '               This period has not yet started. Students and examiners ',
        '               can not access the period until its <strong>start time</strong>, which is ',
        '               <strong>{start_time:date}</strong>',
        '           </p>',
        '       </div>',
        '   </tpl>',
        '   <tpl if="is_active">',
        '       <div class="section ok">',
        '           <h1>Active</h1>',
        '           <p>',
        '               This period is currently active. It started <strong>{start_time:date}</strong> ',
        '               and it expires <strong>{end_time:date}</strong>. When the period expires, examiners ',
        '               will not have access to any data related to the period, including the ',
        '               feedback they have given to students.',
        '           </p>',
        '       </div>',
        '   </tpl>',
        '</div>'
    ),

    getExtraBodyData: function(record) {
        var is_old = record.data.end_time < Ext.Date.now();
        var starttime_in_future = record.data.start_time > Ext.Date.now();
        return {
            is_old: is_old,
            starttime_in_future: starttime_in_future,
            is_active: (!is_old && !starttime_in_future),
        };
    },

    initComponent: function() {
        Ext.apply(this, {
            relatedButtons: [{
                xtype: 'button',
                scale: 'large',
                text: 'Overview of all students',
                listeners: {
                    scope: this,
                    click: this._onPeriodOverview
                }
            }]
        });
        this.callParent(arguments);
    },

    _onPeriodOverview: function() {
        window.location.href = Ext.String.format('{0}/statistics/admin/{1}',
            DevilrySettings.DEVILRY_URLPATH_PREFIX,
            this.record.get('id')
        );
    }
});
{'fraction_non_alphanumeric': 0.1342788727205747, 'fraction_numerical': 0.0025787437833855223, 'mean_word_length': 1.5057683433317952, 'pattern_counts': {'":': 0, '<': 81, '<?xml version=': 0, '>': 81, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5047349', 'n_tokens_mistral': 1469, 'n_tokens_neox': 1483, 'n_words': 349}