<commit_before>//
//  KPShopScoreInfoView.swift
//  kapi-kaffeine
//
//  Created by <NAME> on 2017/4/12.
//  Copyright © 2017年 kapi-kaffeine. All rights reserved.
//

import UIKit

class KPShopRateInfoView: UIView {

    var rateTitles = ["WiFi穩定", "安靜程度", "價格實惠",
                      "座位數量", "咖啡品質", "餐點美味",
                      "環境舒適"]
    var rateImages = [R.image.icon_wifi(), R.image.icon_sleep(), R.image.icon_money(),
                      R.image.icon_seat(), R.image.icon_cup(), R.image.icon_cutlery(),
                      R.image.icon_pic()]
    
    var rateViews: [rateStatusView] = [rateStatusView]()
    var rateContents = [String]()
    
    weak var dataModel: KPDataModel! {
        didSet {
            rateContents = []
            rateContents.append(dataModel.wifiAverage != nil ?
                (dataModel.wifiAverage?.stringValue.characters.count == 1 ?
                    "\((dataModel.wifiAverage?.stringValue)!).0" :
                    "\((dataModel.wifiAverage?.stringValue)!)") :
                "0.0")
            rateContents.append(dataModel.quietAverage != nil ?
                (dataModel.quietAverage?.stringValue.characters.count == 1 ?
                    "\((dataModel.quietAverage?.stringValue)!).0" :
                    "\((dataModel.quietAverage?.stringValue)!)") :
                "0.0")
            rateContents.append(dataModel.cheapAverage != nil ?
                (dataModel.cheapAverage?.stringValue.characters.count == 1 ?
                    "\((dataModel.cheapAverage?.stringValue)!).0" :
                    "\((dataModel.cheapAverage?.stringValue)!)") :
                "0.0")
            rateContents.append(dataModel.seatAverage != nil ?
                (dataModel.seatAverage?.stringValue.characters.count == 1 ?
                    "\((dataModel.seatAverage?.stringValue)!).0" :
                    "\((dataModel.seatAverage?.stringValue)!)") :
                "0.0")
            rateContents.append(dataModel.tastyAverage != nil ?
                (dataModel.tastyAverage?.stringValue.characters.count == 1 ?
                    "\((dataModel.tastyAverage?.stringValue)!).0" :
                    "\((dataModel.tastyAverage?.stringValue)!)") :
                "0.0")
            rateContents.append(dataModel.foodAverage != nil ?
                (dataModel.foodAverage?.stringValue.characters.count == 1 ?
                    "\((dataModel.foodAverage?.stringValue)!).0" :
                    "\((dataModel.foodAverage?.stringValue)!)") :
                "0.0")
            rateContents.append(dataModel.musicAverage != nil ?
                (dataModel.musicAverage?.stringValue.characters.count == 1 ?
                    "\((dataModel.musicAverage?.stringValue)!).0" :
                    "\((dataModel.musicAverage?.stringValue)!)") :
                "0.0")
            
            for (index, rateView) in rateViews.enumerated() {
                rateView.rateContentLabel.text = rateContents[index]
            }
        }
    }
    
    var rateData: KPRateDataModel! {
        didSet {
            rateContents = []
            rateContents.append(rateData.wifiAverage != nil ?
                (rateData.wifiAverage?.stringValue.characters.count == 1 ?
                    "\((rateData.wifiAverage?.stringValue)!).0" :
                    "\((rateData.wifiAverage?.stringValue)!)") :
                "0.0")
            rateContents.append(rateData.quietAverage != nil ?
                (rateData.quietAverage?.stringValue.characters.count == 1 ?
                    "\((rateData.quietAverage?.stringValue)!).0" :
                    "\((rateData.quietAverage?.stringValue)!)") :
                "0.0")
            rateContents.append(rateData.cheapAverage != nil ?
                (rateData.cheapAverage?.stringValue.characters.count == 1 ?
                    "\((rateData.cheapAverage?.stringValue)!).0" :
                    "\((rateData.cheapAverage?.stringValue)!)") :
                "0.0")
            rateContents.append(rateData.seatAverage != nil ?
                (rateData.seatAverage?.stringValue.characters.count == 1 ?
                    "\((rateData.seatAverage?.stringValue)!).0" :
                    "\((rateData.seatAverage?.stringValue)!)") :
                "0.0")
            rateContents.append(rateData.tastyAverage != nil ?
                (rateData.tastyAverage?.stringValue.characters.count == 1 ?
                    "\((rateData.tastyAverage?.stringValue)!).0" :
                    "\((rateData.tastyAverage?.stringValue)!)") :
                "0.0")
            rateContents.append(rateData.foodAverage != nil ?
                (rateData.foodAverage?.stringValue.characters.count == 1 ?
                    "\((rateData.foodAverage?.stringValue)!).0" :
                    "\((rateData.foodAverage?.stringValue)!)") :
                "0.0")
            rateContents.append(rateData.musicAverage != nil ?
                (rateData.musicAverage?.stringValue.characters.count == 1 ?
                    "\((rateData.musicAverage?.stringValue)!).0" :
                    "\((rateData.musicAverage?.stringValue)!)") :
                "0.0")
            
            for (index, rateView) in rateViews.enumerated() {
                rateView.rateContentLabel.text = rateContents[index]
            }
        }
    }
    <commit_msg>Handle limited time and standing desk status<commit_after>//
//  KPShopScoreInfoView.swift
//  kapi-kaffeine
//
//  Created by <NAME> on 2017/4/12.
//  Copyright © 2017年 kapi-kaffeine. All rights reserved.
//

import UIKit

class KPShopRateInfoView: UIView {

    var rateTitles = ["WiFi穩定", "安靜程度", "價格實惠",
                      "座位數量", "咖啡品質", "餐點美味",
                      "環境舒適", "有無限時", "站立座位"]
    var rateImages = [R.image.icon_wifi(), R.image.icon_sleep(), R.image.icon_money(),
                      R.image.icon_seat(), R.image.icon_cup(), R.image.icon_cutlery(),
                      R.image.icon_pic(), R.image.icon_clock(), R.image.icon_seat()]
    
    var rateViews: [rateStatusView] = [rateStatusView]()
    var rateContents = [String]()
    
    weak var dataModel: KPDataModel! {
        didSet {
            rateContents = []
            rateContents.append(dataModel.wifiAverage != nil ?
                (dataModel.wifiAverage?.stringValue.characters.count == 1 ?
                    "\((dataModel.wifiAverage?.stringValue)!).0" :
                    "\((dataModel.wifiAverage?.stringValue)!)") :
                "0.0")
            rateContents.append(dataModel.quietAverage != nil ?
                (dataModel.quietAverage?.stringValue.characters.count == 1 ?
                    "\((dataModel.quietAverage?.stringValue)!).0" :
                    "\((dataModel.quietAverage?.stringValue)!)") :
                "0.0")
            rateContents.append(dataModel.cheapAverage != nil ?
                (dataModel.cheapAverage?.stringValue.characters.count == 1 ?
                    "\((dataModel.cheapAverage?.stringValue)!).0" :
                    "\((dataModel.cheapAverage?.stringValue)!)") :
                "0.0")
            rateContents.append(dataModel.seatAverage != nil ?
                (dataModel.seatAverage?.stringValue.characters.count == 1 ?
                    "\((dataModel.seatAverage?.stringValue)!).0" :
                    "\((dataModel.seatAverage?.stringValue)!)") :
                "0.0")
            rateContents.append(dataModel.tastyAverage != nil ?
                (dataModel.tastyAverage?.stringValue.characters.count == 1 ?
                    "\((dataModel.tastyAverage?.stringValue)!).0" :
                    "\((dataModel.tastyAverage?.stringValue)!)") :
                "0.0")
            rateContents.append(dataModel.foodAverage != nil ?
                (dataModel.foodAverage?.stringValue.characters.count == 1 ?
                    "\((dataModel.foodAverage?.stringValue)!).0" :
                    "\((dataModel.foodAverage?.stringValue)!)") :
                "0.0")
            rateContents.append(dataModel.musicAverage != nil ?
                (dataModel.musicAverage?.stringValue.characters.count == 1 ?
                    "\((dataModel.musicAverage?.stringValue)!).0" :
                    "\((dataModel.musicAverage?.stringValue)!)") :
                "0.0")
            
            
            if let limitedTime = dataModel.limitedTime {
                if limitedTime == 1 {
                    rateContents.append("客滿")
                } else if limitedTime == 2 {
                    rateContents.append("不限")
                } else if limitedTime == 3 {
                    rateContents.append("人多")
                } else if limitedTime == 4 {
                    rateContents.append("未知")
                }
            } else {
                rateContents.append("未知")
            }
            
            if let standingDesk = dataModel.standingDesk {
                if standingDesk == 1 {
                    rateContents.append("有")
                } else if standingDesk == 4 {
                    rateContents.append("未知")
                } else {
                    rateContents.append("未知")
                }
            } else {
                rateContents.append("未知")
            }
            
            for (index, rateView) in rateViews.enumerated() {
                rateView.rateContentLabel.text = rateContents[index]
            }
        }
    }
    
    var rateData: KPRateDataModel! {
        didSet {
            rateContents = []
            rateContents.append(rateData.wifiAverage != nil ?
                (rateData.wifiAverage?.stringValue.characters.count == 1 ?
                    "\((rateData.wifiAverage?.stringValue)!).0" :
                    "\((rateData.wifiAverage?.stringValue)!)") :
                "0.0")
            rateContents.append(rateData.quietAverage != nil ?
                (rateData.quietAverage?.stringValue.characters.count == 1 ?
                    "\((rateData.quietAverage?.stringValue)!).0" :
                    "\((rateData.quietAverage?.stringValue)!)") :
                "0.0")
            rateContents.append(rateData.cheapAverage != nil ?
                (rateData.cheapAverage?.stringValue.characters.count == 1 ?
                    "\((rateData.cheapAverage?.stringValue)!).0" :
                    "\((rateData.cheapAverage?.stringValue)!)") :
                "0.0")
            rateContents.append(rateData.seatAverage != nil ?
                (rateData.seatAverage?.stringValue.characters.count == 1 ?
                    "\((rateData.seatAverage?.stringValue)!).0" :
                    "\((rateData.seatAverage?.stringValue)!)") :
                "0.0")
            rateContents.append(rateData.tastyAverage != nil ?
                (rateData.tastyAverage?.stringValue.characters.count == 1 ?
                    "\((rateData.tastyAverage?.stringValue)!).0" :
                    "\((rateData.tastyAverage?.stringValue)!)") :
                "0.0")
            rateContents.append(rateData.foodAverage != nil ?
                (rateData.foodAverage?.stringValue.characters.count == 1 ?
                    "\((rateData.foodAverage?.stringValue)!).0" :
                    "\((rateData.foodAverage?.stringValue)!)") :
                "0.0")
            rateContents.append(rateData.musicAverage != nil ?
                (rateData.musicAverage?.stringValue.characters.count == 1 ?
                    "\((rateData.musicAverage?.stringValue)!).0" :
                    "\((rateData.musicAverage?.stringValue)!)") :
                "0.0")

            
            if let limitedTime = dataModel.limitedTime {
                if limitedTime == 1 {
                    rateContents.append("客滿")
                } else if limitedTime == 2 {
                    rateContents.append("不限")
                } else if limitedTime == 3 {
                    rateContents.append("人多")
                } else if limitedTime == 4 {
                    rateContents.append("未知")
                }
            } else {
                rateContents.append("未知")
            }
            
            if let standingDesk = dataModel.standingDesk {
                if standingDesk == 1 {
                    rateContents.append("有")
                } else if standingDesk == 4 {
                    rateContents.append("未知")
                } else {
                    rateContents.append("未知")
                }
            } else {
                rateContents.append("未知")
            }
            
            for (index, rateView) in rateViews.enumerated() {
                rateView.rateContentLabel.text = rateContents[index]
            }
        }
    }
    
{'fraction_non_alphanumeric': 0.13736350688400065, 'fraction_numerical': 0.011552460832410192, 'mean_word_length': 1.5132233048319745, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '930670', 'n_tokens_mistral': 3795, 'n_tokens_neox': 3386, 'n_words': 430}