<commit_before>//
//  ViewController.swift
//  ServiceTimeTracker
//
//  Created by <NAME> on 5/11/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import UIKit
import CoreData
import MessageUI

class ViewController: UIViewController, UITableViewDelegate, MFMailComposeViewControllerDelegate {

    //MARK: Variables
    
    @IBOutlet var timeLabel : UILabel!
    @IBOutlet var momentTimeLabel : UILabel!
    @IBOutlet var momentTable : MomentTableView!
    
    var timer = NSTimer()
    var lastStart = NSTimeInterval()
    var lastMoment = NSTimeInterval()
    var inSession = false
    var sessionNumber = 1
    var sessionNamePrefix = "Session"
    var sessionId = "Session 1"
    
    //MARK: Class Overrides
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        setupDefaults()
        setupNotifications()
        // Do any additional setup after loading the view, typically from a nib.
    }
    
    func setupDefaults() {
        let prefs = NSUserDefaults.standardUserDefaults()
        let resetDatabase = prefs.boolForKey("reset_data_pref")
        let namePrefix = prefs.stringForKey("session_name_prefix_pref")
        if resetDatabase {
            databaseDeleteSessions()
            prefs.setBool(false, forKey: "reset_data_pref")
        }
        if namePrefix != nil {
            sessionNamePrefix = namePrefix!<commit_msg>save database after delete<commit_after>//
//  ViewController.swift
//  ServiceTimeTracker
//
//  Created by <NAME> on 5/11/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import UIKit
import CoreData
import MessageUI

class ViewController: UIViewController, UITableViewDelegate, MFMailComposeViewControllerDelegate {

    //MARK: Variables
    
    @IBOutlet var timeLabel : UILabel!
    @IBOutlet var momentTimeLabel : UILabel!
    @IBOutlet var momentTable : MomentTableView!
    
    var timer = NSTimer()
    var lastStart = NSTimeInterval()
    var lastMoment = NSTimeInterval()
    var inSession = false
    var sessionNumber = 1
    var sessionNamePrefix = "Session"
    var sessionId = "Session 1"
    
    //MARK: Class Overrides
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        setupDefaults()
        setupNotifications()
        // Do any additional setup after loading the view, typically from a nib.
    }
    
    func setupDefaults() {
        let prefs = NSUserDefaults.standardUserDefaults()
        let resetDatabase = prefs.boolForKey("reset_data_pref")
        let namePrefix = prefs.stringForKey("session_name_prefix_pref")
        if resetDatabase {
            databaseDeleteSessions()
            saveDatabase()
            prefs.setBool(false, forKey: "reset_data_pref")
        }
        if namePrefix != nil {
            sessionNamePrefix = namePrefix!
{'fraction_non_alphanumeric': 0.08173418621179815, 'fraction_numerical': 0.007818052594171997, 'mean_word_length': 2.6043533930857876, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '3615766', 'n_tokens_mistral': 823, 'n_tokens_neox': 778, 'n_words': 213}