             return super.tableView(tableView, cellForRowAt: indexPath)
         }
         
-        guard let timetable = self.timetable else {
+        guard let timetable = PrimaryUser.loggedIn?.timetable else {
             return super.tableView(tableView, cellForRowAt: indexPath)
         }
         

    
    /// :nodoc:
    override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        guard let timetable = self.timetable else { return 0 }
        
        return timetable[.normalItems, section].count
    }

/// Displays the user's timetable.
class TimetableViewController: UITableViewController {
    
    /// Updates the timetable by making a request to the student timetable service, and reloading the data in the table.
    @objc func updateTimetable() {
        guard let user = PrimaryUser.loggedIn else {
            self.tableView.refreshControl?.endRefreshing()
            return
        }
        
        guard let accessToken = user.authenticator.accessToken else {
            self.tableView.refreshControl?.endRefreshing()
            return
        }
        
        StudentTimetableService(accessToken: accessToken).makeRequest { [weak self, weak user] result in
            switch result {
            case .success(let timetable):
                user?.timetable = timetable
            case .error(let error):
                print(error)
            }
            
            DispatchQueue.main.async {
                self?.tableView.reloadData()
                self?.tableView.refreshControl?.endRefreshing()
            }
        }
    }
