def select_all():
    user_topics = []

    sql = "SELECT * FROM user_topics"
    results = run_sql(sql)

    for result in results:
        user_topic = UserTopic(result["name"], result["id"])
        user_topics.append(user_topic)
    return user_topics
Example #2
0
 def test_new_user_topic_added(self):
     self.user_topic_1 = UserTopic("Anthropology")
     self.assertEqual("Anthropology", self.user_topic_1.name)
Example #3
0
 def setUp(self):
     self.user_topic = UserTopic("Test User_Topic")
def select(id):
    sql = "SELECT * FROM user_topics WHERE id = %s"
    values = [id]
    result = run_sql(sql, values)[0]
    user_topic = UserTopic(result["name"], result["id"])
    return user_topic
def update_user_topic(id):
    name = request.form["name"]
    user_topic = UserTopic(name, id)
    user_topic_repository.update(user_topic)
    return redirect("/user_topics")
def create_user_topic():
    name = request.form["name"]
    new_user_topic = UserTopic(name)
    user_topic_repository.save(new_user_topic)
    return redirect("/user_topics")
Example #7
0
topic_04 = Topic("Science & Nature")
topic_repository.save(topic_04)

topic_05 = Topic("Literature")
topic_repository.save(topic_05)

topic_06 = Topic("Entertainment")
topic_repository.save(topic_06)

topic_07 = Topic("The Arts")
topic_repository.save(topic_07)

topic_08 = Topic("Music")
topic_repository.save(topic_08)

user_topic_00 = UserTopic("--none--")
user_topic_repository.save(user_topic_00)

user_topic_01 = UserTopic("Football")
user_topic_repository.save(user_topic_01)

user_topic_02 = UserTopic("Physics")
user_topic_repository.save(user_topic_02)

difficulty_0 = Difficulty("MIXED")
difficulty_repository.save(difficulty_0)

difficulty_1 = Difficulty("EASY")
difficulty_repository.save(difficulty_1)

difficulty_2 = Difficulty("MEDIUM")