<commit_before>use super::schema::*;

#[derive(Queryable, Identifiable)]
#[table_name="answer"]
pub struct Answer {
    pub id: i32,
    pub question_id: i32,
    pub text: String,
    pub is_correct: bool,
}

HasMany! {
    (answer, foreign_key = question_id)
    #[table_name(question)]
    #[derive(Queryable, Identifiable)]
    pub struct Question {
        pub id: i32,
        pub category_id: i32,
        pub text: String,
        pub answers: Vec<Answer>,
    }
}

HasMany! {
    (question, foreign_key = category_id)
    #[table_name(category)]
    #[derive(Queryable, Identifiable)]
    pub struct Category {
        pub id: i32,
        pub text: String,
    }
}



pub struct Player {}

pub struct Game {}<commit_msg>Untangle the HasMany mess<commit_after>use super::schema::*;

#[table_name="category"]
#[derive(Queryable, Identifiable, Associations, Debug)]
#[has_many(question)]
pub struct Category {
        pub id: i32,
        pub text: String,
}


#[table_name="question"]
#[derive(Queryable, Identifiable, Associations)]
#[has_many(answer)]
#[belongs_to(Category)]
pub struct Question {
    pub id: i32,
    pub category_id: i32,
    pub text: String
}

#[table_name="answer"]
#[derive(Queryable, Identifiable, Associations)]
#[belongs_to(Question)]
pub struct Answer {
    pub id: i32,
    pub question_id: i32,
    pub text: String,
    pub is_correct: bool,
}


pub struct Player {}

pub struct Game {}
{'fraction_non_alphanumeric': 0.1297335203366059, 'fraction_numerical': 0.014025245441795231, 'mean_word_length': 3.5884244372990355, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '2310713', 'n_tokens_mistral': 479, 'n_tokens_neox': 485, 'n_words': 128}