<commit_before>//
//  ServerTableView.swift
//  viossvc
//
//  Created by 木柳 on 2016/12/2.
//  Copyright © 2016年 com.yundian. All rights reserved.
//

import UIKit

class ServerCell: UITableViewCell {
    @IBOutlet weak var upLine: UIView!
    @IBOutlet weak var serverNameLabel: UILabel!
    @IBOutlet weak var serverTimeLabel: UILabel!
    @IBOutlet weak var serverPriceLabel: UILabel!
}

class ServerTableView: UITableView, UITableViewDelegate, UITableViewDataSource {
    var serverData: [UserServerModel] = []
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        delegate = self
        dataSource = self
        scrollEnabled = false
    }
    
    //MARK: --delegate and datasource
    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return serverData.count
    }
    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell: ServerCell = tableView.dequeueReusableCellWithIdentifier(ServerCell.className()) as! ServerCell
        let model = serverData[indexPath.row]
        cell.serverNameLabel.text = model.service_name
        cell.serverNameLabel.backgroundColor = UIColor.grayColor()
        cell.serverPriceLabel.text = "￥\(Double(model.service_price)/100)"
        cell.serverPriceLabel.backgroundColor = UIColor.redColor()
        cell.serverTimeLabel.text = "\(time(model.service_start))--\(time(model.service_end))"
        cell.serverTimeLabel.backgroundColor = UIColor.yellowColor()
        cell.upLine.hidden = indexPath.row == 0
        return cell
    }
    func time(minus: Int) -> String {
        let hour = minus / 60
        let leftMinus = minus % 60
        return String(format: "%02d:%02d", hour, leftMinus) //"\(hourStr):\(minusStr)"
//        let hourStr = hour > 9 ? "\(hour)" : "0\(hour)"
//        let minusStr = leftMinus > 9 ? "\(minus)" : "0\(leftMinus)"
//        return "\(hourStr):\(minusStr)"
    }
    func updateData(data: AnyObject!, complete:CompleteBlock) {
        serverData = data as! [UserServerModel]
        reloadData()
        complete(contentSize.height > 0 ? contentSize.height+20 : 0)
    }
    
}<commit_msg>fix bug<commit_after>//
//  ServerTableView.swift
//  viossvc
//
//  Created by 木柳 on 2016/12/2.
//  Copyright © 2016年 com.yundian. All rights reserved.
//

import UIKit

class ServerCell: UITableViewCell {
    @IBOutlet weak var upLine: UIView!
    @IBOutlet weak var serverNameLabel: UILabel!
    @IBOutlet weak var serverTimeLabel: UILabel!
    @IBOutlet weak var serverPriceLabel: UILabel!
}

class ServerTableView: UITableView, UITableViewDelegate, UITableViewDataSource {
    var serverData: [UserServerModel] = []
    
    required init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder)
        delegate = self
        dataSource = self
        scrollEnabled = false
    }
    
    //MARK: --delegate and datasource
    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return serverData.count
    }
    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
        let cell: ServerCell = tableView.dequeueReusableCellWithIdentifier(ServerCell.className()) as! ServerCell
        let model = serverData[indexPath.row]
        cell.serverNameLabel.text = model.service_name
        cell.serverPriceLabel.text = "￥\(Double(model.service_price)/100)"
        cell.serverTimeLabel.text = "\(time(model.service_start))--\(time(model.service_end))"
        cell.upLine.hidden = indexPath.row == 0
        return cell
    }
    func time(minus: Int) -> String {
        let hour = minus / 60
        let leftMinus = minus % 60
        return String(format: "%02d:%02d", hour, leftMinus) //"\(hourStr):\(minusStr)"
//        let hourStr = hour > 9 ? "\(hour)" : "0\(hour)"
//        let minusStr = leftMinus > 9 ? "\(minus)" : "0\(leftMinus)"
//        return "\(hourStr):\(minusStr)"
    }
    func updateData(data: AnyObject!, complete:CompleteBlock) {
        serverData = data as! [UserServerModel]
        reloadData()
        complete(contentSize.height > 0 ? contentSize.height+20 : 0)
    }
    
}
{'fraction_non_alphanumeric': 0.11764705882352941, 'fraction_numerical': 0.014646822584455469, 'mean_word_length': 2.9059040590405902, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1071991', 'n_tokens_mistral': 1384, 'n_tokens_neox': 1282, 'n_words': 297}