<commit_before>(function (FMS, Backbone, _, $) {
    _.extend( FMS, {
        SubmitView: FMS.FMSView.extend({
            template: 'submit',
            id: 'submit-page',
            prev: 'details',

            events: {
                'pagehide': 'destroy',
                'pageshow': 'afterDisplay',
                'click .ui-btn-left': 'onClickButtonPrev',
                'click .ui-btn-right': 'onClickButtonNext',
                'click #submit_signed_in': 'onClickSubmit',
                'click #submit_sign_in': 'onClickSubmit',
                'click #submit_register': 'onClickSubmit'
            },

            render: function(){
                if ( !this.template ) {
                    console.log('no template to render');
                    return;
                }
                template = _.template( tpl.get( this.template ) );
                if ( this.model ) {
                    this.$el.html(template({ model: this.model.toJSON(), user: FMS.currentUser.toJSON() }));
                } else {
                    this.$el.html(template());
                }
                this.afterRender();
                return this;
            },

            onClickSubmit: function(e) {
                this.beforeSubmit();

                if ( this.validate() ) {
                    this.model.set('user', FMS.currentUser);
                    this.report = new FMS.Report( this.model.toJSON() );
                    this.listenTo( this.report, 'sync', this.onReportSync );
                    this.listenTo( this.report, 'error', this.onReportError );
                    this.report.save();
                }
            },

            onReportSync: function(model, resp, options) {
                this.stopListening();
                if ( FMS.currentUser ) {
                    FMS.currentUser.save();
                }
                var id = FMS.currentDraft.id;
                var uri = FMS.currentDraft.get('file');
                FMS.allDrafts.remove(FMS.currentDraft);
                FMS.currentDraft.destroy();
                localStorage.currentDraftID = null;
                FMS.createdReport = this.report;

                if ( uri ) {
                    var del = FMS.files.deleteURI( this.photoURI );

                    var that = this;
                    del.done( function() { that.navigate( 'sent' ); } );

                } else {
                    this.navigate( 'sent', 'left' );
                }<commit_msg>reset current draft after we have removed it<commit_after>(function (FMS, Backbone, _, $) {
    _.extend( FMS, {
        SubmitView: FMS.FMSView.extend({
            template: 'submit',
            id: 'submit-page',
            prev: 'details',

            events: {
                'pagehide': 'destroy',
                'pageshow': 'afterDisplay',
                'click .ui-btn-left': 'onClickButtonPrev',
                'click .ui-btn-right': 'onClickButtonNext',
                'click #submit_signed_in': 'onClickSubmit',
                'click #submit_sign_in': 'onClickSubmit',
                'click #submit_register': 'onClickSubmit'
            },

            render: function(){
                if ( !this.template ) {
                    console.log('no template to render');
                    return;
                }
                template = _.template( tpl.get( this.template ) );
                if ( this.model ) {
                    this.$el.html(template({ model: this.model.toJSON(), user: FMS.currentUser.toJSON() }));
                } else {
                    this.$el.html(template());
                }
                this.afterRender();
                return this;
            },

            onClickSubmit: function(e) {
                this.beforeSubmit();

                if ( this.validate() ) {
                    this.model.set('user', FMS.currentUser);
                    this.report = new FMS.Report( this.model.toJSON() );
                    this.listenTo( this.report, 'sync', this.onReportSync );
                    this.listenTo( this.report, 'error', this.onReportError );
                    this.report.save();
                }
            },

            onReportSync: function(model, resp, options) {
                this.stopListening();
                if ( FMS.currentUser ) {
                    FMS.currentUser.save();
                }
                var id = FMS.currentDraft.id;
                var uri = FMS.currentDraft.get('file');
                FMS.allDrafts.remove(FMS.currentDraft);
                FMS.currentDraft.destroy();
                FMS.currentDraft = new FMS.Draft();
                localStorage.currentDraftID = null;
                FMS.createdReport = this.report;

                if ( uri ) {
                    var del = FMS.files.deleteURI( this.photoURI );

                    var that = this;
                    del.done( function() { that.navigate( 'sent' ); } );

                } else {
                    this.navigate( 'sent', 'left' );
                }
{'fraction_non_alphanumeric': 0.12200435729847495, 'fraction_numerical': 0.0, 'mean_word_length': 1.2013949433304272, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1423262', 'n_tokens_mistral': 1369, 'n_tokens_neox': 1264, 'n_words': 240}