<commit_before>//
//  MainFeedViewController.swift
//  Duo
//
//  Created by Bobo on 10/24/15.
//  Copyright © 2015 <NAME>. All rights reserved.
//

import UIKit
import CoreData

class MainFeedViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {

    @IBOutlet weak var tableView: UITableView!
    
    var managedObjectContext: NSManagedObjectContext?
    
    var currentList: List?
    
    // MARK: Life cycle
    override func viewDidLoad() {
        
//        currentList = List.existingOrNewListForCategory(Enums.questionsCateroryToString(Enums.questionsCategory.Hot), inManageObjectContext: managedObjectContext)
        
        tableView.delegate = self
        tableView.dataSource = self
        
        let path: String? = NSBundle(forClass: self.classForCoder).pathForResource("MockedQuestions", ofType: "json")
        let jsonData = NSData(contentsOfFile: path!)
        let dict: Dictionary<String, AnyObject>?
        dict = try! NSJSONSerialization.JSONObjectWithData(jsonData!, options: NSJSONReadingOptions.MutableContainers) as? Dictionary<String, AnyObject>

        currentList = List.existingOrNewListWithDictionary(dict!, inManageObjectContext: managedObjectContext)
        
//        refreshData()
    }
    
    private func refreshData() {
        QuestionsService.getQuestionsForCategory(Enums.questionsCategory.Hot, inManagedObjectContext: managedObjectContext!) { (questions, error) -> Void in
            if (error == nil) {
                self.currentList = questions
                self.tableView.reloadData()
            } else {
                ErrorHandler.handleError(error!, forViewController: self)
            }
        }
    }
    
    // MARK: UITableViewDataSource
    func numberOfSectionsInTableView(tableView: UITableView) -> Int {
        return 1
    }
    
    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return currentList!.questions!.count
    }
    
    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        
        let cell:QuestionTableViewCell = tableView.dequeueReusableCellWithIdentifier("questionCell", forIndexPath: indexPath) as! QuestionTableViewCell
        
        let question:Question = currentList!.questions![indexPath.row] as! Question
        
        cell.textBodyLabel.text = question.textBody
                
        return cell
    }
}
<commit_msg>Reverted changes to mock data<commit_after>//
//  MainFeedViewController.swift
//  Duo
//
//  Created by Bobo on 10/24/15.
//  Copyright © 2015 <NAME>. All rights reserved.
//

import UIKit
import CoreData

class MainFeedViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {

    @IBOutlet weak var tableView: UITableView!
    
    var managedObjectContext: NSManagedObjectContext?
    
    var currentList: List?
    
    // MARK: Life cycle
    override func viewDidLoad() {
        
        currentList = List.existingOrNewListForCategory(Enums.questionsCateroryToString(Enums.questionsCategory.Hot), inManageObjectContext: managedObjectContext)
        
        tableView.delegate = self
        tableView.dataSource = self
                
        refreshData()
    }
    
    private func refreshData() {
        QuestionsService.getQuestionsForCategory(Enums.questionsCategory.Hot, inManagedObjectContext: managedObjectContext!) { (questions, error) -> Void in
            if (error == nil) {
                self.currentList = questions
                self.tableView.reloadData()
            } else {
                ErrorHandler.handleError(error!, forViewController: self)
            }
        }
    }
    
    // MARK: UITableViewDataSource
    func numberOfSectionsInTableView(tableView: UITableView) -> Int {
        return 1
    }
    
    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return currentList!.questions!.count
    }
    
    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        
        let cell:QuestionTableViewCell = tableView.dequeueReusableCellWithIdentifier("questionCell", forIndexPath: indexPath) as! QuestionTableViewCell
        
        let question:Question = currentList!.questions![indexPath.row] as! Question
        
        cell.textBodyLabel.text = question.textBody
                
        return cell
    }
}

{'fraction_non_alphanumeric': 0.08123877917414722, 'fraction_numerical': 0.004937163375224416, 'mean_word_length': 2.7049044056525355, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, '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': '7540108', 'n_tokens_mistral': 1253, 'n_tokens_neox': 1148, 'n_words': 251}