<commit_before>import Foundation
import UIKit
import DGElasticPullToRefresh


class JourneyVC : UIViewController, PointSelectedProtocol {
    @IBOutlet weak var noDataView: UIView!
    @IBOutlet weak var chartView: UIView!
    @IBOutlet weak var containerView: UIScrollView!
    private var graph : ScrollableGraphView!
    private var journey : Journey!
    @IBOutlet weak var statsBarView: UIView!
    @IBOutlet weak var avgField: UILabel!
    @IBOutlet weak var medianField: UILabel!

    
    override open func loadView() {
        super.loadView()
        graph = ScrollableGraphView(frame: chartView.frame, delegate: self)
        JourneyCache.map { self.updateView(withJourney: $0) }
        containerView.onPull(self.loadJourneyGraphData)
    }
    
    override open func viewDidLoad() {
        super.viewDidLoad()
        loadJourneyGraphData()
    }
    
    func loadJourneyGraphData() {
        BroccoliAPI().journey(
            onSuccess: { fetchedData in
                self.updateView(withJourney: Journey(data: fetchedData))
                JourneyCache.save(fetchedData)
                self.containerView.dg_stopLoading()
            },
            onUnauthorized: self.performExplainedLogout
        )
    }
    
    func updateView(withJourney journey: Journey) {
        self.journey = journey
        self.noDataView.isHidden = journey.hasStarted()
        self.chartView.isHidden = journey.isEmpty()
        self.statsBarView.isHidden = journey.isEmpty()
        if journey.hasStarted() {
            graph.set(data: self.journey.levels(), withLabels: self.journey.days())
            self.chartView.subviews.forEach{$0.removeFromSuperview()}
            self.chartView.addSubview(graph)
            self.display(journeyStatistics: JourneyStats(journey))
        }
    }
    
    func display(journeyStatistics: JourneyStats) {
        self.avgField.text = String(journeyStatistics.average())
        self.medianField.text = String(journeyStatistics.median())
    }
    
    func pointWasSelectedAt(index:Int, label: String, value: Double, location: CGPoint) {
        AZDialogViewController(day: journey.day(atIndex: index)).show(in: self)
    }
}
<commit_msg>Fix glitch with JourneyVC views<commit_after>import Foundation
import UIKit
import DGElasticPullToRefresh


class JourneyVC : UIViewController, PointSelectedProtocol {
    @IBOutlet weak var noDataView: UIView!
    @IBOutlet weak var chartView: UIView!
    @IBOutlet weak var containerView: UIScrollView!
    private var graph : ScrollableGraphView!
    private var journey : Journey!
    @IBOutlet weak var statsBarView: UIView!
    @IBOutlet weak var avgField: UILabel!
    @IBOutlet weak var medianField: UILabel!
    
    
    override open func loadView() {
        super.loadView()
        containerView.isHidden = true
        graph = ScrollableGraphView(frame: chartView.frame, delegate: self)
        JourneyCache.map { self.updateView(withJourney: $0) }
        containerView.onPull(self.loadJourneyGraphData)
    }
    
    override open func viewDidLoad() {
        super.viewDidLoad()
        loadJourneyGraphData()
    }
    
    func loadJourneyGraphData() {
        BroccoliAPI().journey(
            onSuccess: { fetchedData in
                self.updateView(withJourney: Journey(data: fetchedData))
                JourneyCache.save(fetchedData)
                self.containerView.dg_stopLoading()
            },
            onUnauthorized: self.performExplainedLogout
        )
    }
    
    func updateView(withJourney journey: Journey) {
        self.journey = journey
        self.presentCorrectViews()
        if journey.hasStarted() {
            graph.set(data: self.journey.levels(), withLabels: self.journey.days())
            self.chartView.subviews.forEach{$0.removeFromSuperview()}
            self.chartView.addSubview(graph)
            self.display(journeyStatistics: JourneyStats(journey))
        }
    }
    
    func presentCorrectViews() {
        self.noDataView.isHidden = journey.hasStarted()
        self.chartView.isHidden = journey.isEmpty()
        self.statsBarView.isHidden = journey.isEmpty()
        self.containerView.isHidden = false
    }
    
    func display(journeyStatistics: JourneyStats) {
        self.avgField.text = String(journeyStatistics.average())
        self.medianField.text = String(journeyStatistics.median())
    }
    
    func pointWasSelectedAt(index:Int, label: String, value: Double, location: CGPoint) {
        AZDialogViewController(day: journey.day(atIndex: index)).show(in: self)
    }
}

{'fraction_non_alphanumeric': 0.08989256741942557, 'fraction_numerical': 0.0008770006577504934, 'mean_word_length': 2.7485620377978637, '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': '4711355', 'n_tokens_mistral': 1358, 'n_tokens_neox': 1307, 'n_words': 255}