<commit_before>(function (FMS, Backbone, _, $) {
    _.extend( FMS, {
        ExistingView: FMS.FMSView.extend({
            template: 'existing',
            id: 'existing',

            events: {
                'pagehide': 'destroy',
                'pageshow': 'afterDisplay',
                'click #use_report': 'useReport',
                'click #save_report': 'saveReport',
                'click #discard': 'discardReport'
            },

            useReport: function() {
                FMS.setCurrentDraft(this.model);
                this.navigate('around');
            },

            saveReport: function() {
                FMS.clearCurrentDraft();
                this.navigate('around');
            },

            discardReport: function() {
                var reset = FMS.removeDraft(this.model.id, true);
                var that = this;
                reset.done( function() { that.onDraftRemove(); } );
            },

            onDraftRemove: function() {
                this.navigate( 'around', 'left' );
            }
        })
    });
})(FMS, Backbone, _, $);<commit_msg>when we discard an in progress draft on startup make sure we do it properly<commit_after>(function (FMS, Backbone, _, $) {
    _.extend( FMS, {
        ExistingView: FMS.FMSView.extend({
            template: 'existing',
            id: 'existing',

            events: {
                'pagehide': 'destroy',
                'pageshow': 'afterDisplay',
                'click #use_report': 'useReport',
                'click #save_report': 'saveReport',
                'click #discard': 'discardReport'
            },

            useReport: function() {
                FMS.setCurrentDraft(this.model);
                this.navigate('around');
            },

            saveReport: function() {
                FMS.clearCurrentDraft();
                this.navigate('around');
            },

            discardReport: function() {
                var reset = FMS.removeDraft(this.model.id, true);
                var that = this;
                reset.done( function() { that.onDraftRemove(); } );
            },

            onDraftRemove: function() {
                FMS.clearCurrentDraft();
                this.navigate( 'around', 'left' );
            }
        })
    });
})(FMS, Backbone, _, $);
{'fraction_non_alphanumeric': 0.13356311934510987, 'fraction_numerical': 0.0, 'mean_word_length': 1.3864337101747173, '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': '4978101', 'n_tokens_mistral': 643, 'n_tokens_neox': 602, 'n_words': 119}