<commit_before><?php

class TalkMapper extends ApiMapper {
    public function getDefaultFields() {
        $fields = array(
            'talk_title' => 'talk_title',
            'url_friendly_talk_title' => 'url_friendly_talk_title',
            'talk_description' => 'talk_desc',
            'type' => 'category',
            'start_date' => 'date_given',
			'duration' => 'duration',
            'stub' => 'stub',
            'average_rating' => 'avg_rating',
            'comments_enabled' => 'comments_enabled',
            'comment_count' => 'comment_count'
            );
        return $fields;
    }

    public function getVerboseFields() {
        $fields = array(
            'talk_title' => 'talk_title',
            'url_friendly_talk_title' => 'url_friendly_talk_title',
            'talk_description' => 'talk_desc',
            'type' => 'category',
            'slides_link' => 'slides_link',
            'language' => 'lang_name',
            'start_date' => 'date_given',
			'duration' => 'duration',
            'stub' => 'stub',
            'average_rating' => 'avg_rating',
            'comments_enabled' => 'comments_enabled',
            'comment_count' => 'comment_count'
            );
        return $fields;
    }

    public function getTalksByEventId($event_id, $resultsperpage, $start, $verbose = false) {
        $sql = $this->getBasicSQL();
        $sql .= ' and t.event_id = :event_id';
        $sql .= ' order by t.date_given';
        $sql .= $this->buildLimit($resultsperpage, $start);

        $stmt = $this->_db->prepare($sql);
        $response = $stmt->execute(array(
            ':event_id' => $event_id
            ));
        if($response) {
            $results = $stmt->fetchAll(PDO::FETCH_ASSOC);
            $retval = $this->transformResults($results, $verbose);
            return $retval;
        }
        return false;
    }

    public function transformResults($results, $verbose) {
        $list = parent::transformResults($results, $verbose);
        $base = $this->_request->base;
        $version = $this->_request->version;

        // loop again and add links specific to this item
        if(is_array($list) && count($list)) {
            foreach($results as $key => $row) {
                // generate and store an inflected talk title if there isn't one
                if(empty($row['url_friendly_talk_title'])) {
                    $list[$key]['url_friendly_talk_title'] = $this->generateInflectedTitle($row['talk_title'], $row['ID']);
                }

                // if the stub is empty, we need to generate one and store it
                if(empty($row['stub'])) {
                    $list[$key]['stub'] = $this->generateStub($row['ID']);
                }
                // add speakers
                $list[$key]['speakers'] = $this->getSpeakers($row['ID']);
                $list[$key]['tracks'] = $this->getTracks($row['ID']);
                $list[$key]['uri'] = $base . '/' . $version . '/talks/' . $row['ID'];
                $list[$key]['verbose_uri'] = $base . '/' . $version . '/talks/' . $row['ID'] . '?verbose=yes';
                $list[$key]['website_uri'] = 'http://joind.in/talk/view/' . $row['ID'];
                $list[$key]['comments_uri'] = $base . '/' . $version . '/talks/' . $row['ID'] . '/comments';
                $list[$key]['verbose_comments_uri'] = $base . '/' . $version . '/talks/' . $row['ID'] . '/comments?verbose=yes';
                $list[$key]['event_uri'] = $base . '/' . $version . '/events/' . $row['event_id'];
            }
        }
<commit_msg>Add talk attending_uri to output.<commit_after><?php

class TalkMapper extends ApiMapper {
    public function getDefaultFields() {
        $fields = array(
            'talk_title' => 'talk_title',
            'url_friendly_talk_title' => 'url_friendly_talk_title',
            'talk_description' => 'talk_desc',
            'type' => 'category',
            'start_date' => 'date_given',
			'duration' => 'duration',
            'stub' => 'stub',
            'average_rating' => 'avg_rating',
            'comments_enabled' => 'comments_enabled',
            'comment_count' => 'comment_count'
            );
        return $fields;
    }

    public function getVerboseFields() {
        $fields = array(
            'talk_title' => 'talk_title',
            'url_friendly_talk_title' => 'url_friendly_talk_title',
            'talk_description' => 'talk_desc',
            'type' => 'category',
            'slides_link' => 'slides_link',
            'language' => 'lang_name',
            'start_date' => 'date_given',
			'duration' => 'duration',
            'stub' => 'stub',
            'average_rating' => 'avg_rating',
            'comments_enabled' => 'comments_enabled',
            'comment_count' => 'comment_count'
            );
        return $fields;
    }

    public function getTalksByEventId($event_id, $resultsperpage, $start, $verbose = false) {
        $sql = $this->getBasicSQL();
        $sql .= ' and t.event_id = :event_id';
        $sql .= ' order by t.date_given';
        $sql .= $this->buildLimit($resultsperpage, $start);

        $stmt = $this->_db->prepare($sql);
        $response = $stmt->execute(array(
            ':event_id' => $event_id
            ));
        if($response) {
            $results = $stmt->fetchAll(PDO::FETCH_ASSOC);
            $retval = $this->transformResults($results, $verbose);
            return $retval;
        }
        return false;
    }

    public function transformResults($results, $verbose) {
        $list = parent::transformResults($results, $verbose);
        $base = $this->_request->base;
        $version = $this->_request->version;

        // loop again and add links specific to this item
        if(is_array($list) && count($list)) {
            foreach($results as $key => $row) {
                // generate and store an inflected talk title if there isn't one
                if(empty($row['url_friendly_talk_title'])) {
                    $list[$key]['url_friendly_talk_title'] = $this->generateInflectedTitle($row['talk_title'], $row['ID']);
                }

                // if the stub is empty, we need to generate one and store it
                if(empty($row['stub'])) {
                    $list[$key]['stub'] = $this->generateStub($row['ID']);
                }
                // add speakers
                $list[$key]['speakers'] = $this->getSpeakers($row['ID']);
                $list[$key]['tracks'] = $this->getTracks($row['ID']);
                $list[$key]['uri'] = $base . '/' . $version . '/talks/' . $row['ID'];
                $list[$key]['verbose_uri'] = $base . '/' . $version . '/talks/' . $row['ID'] . '?verbose=yes';
                $list[$key]['website_uri'] = 'http://joind.in/talk/view/' . $row['ID'];
                $list[$key]['comments_uri'] = $base . '/' . $version . '/talks/' . $row['ID'] . '/comments';
                $list[$key]['attending_uri'] = $base . '/' . $version . '/talks/' . $row['ID'] . '/attending';
                $list[$key]['verbose_comments_uri'] = $base . '/' . $version . '/talks/' . $row['ID'] . '/comments?verbose=yes';
                $list[$key]['event_uri'] = $base . '/' . $version . '/events/' . $row['event_id'];
            }
        }

{'fraction_non_alphanumeric': 0.17925436786353005, 'fraction_numerical': 0.0, 'mean_word_length': 1.9868529170090385, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 81, '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': '6169179', 'n_tokens_mistral': 2163, 'n_tokens_neox': 2103, 'n_words': 396}