<commit_before>#!/usr/local/bin/python3

"""
created_by:         <NAME>
created_date:       3/5/2015
last_modified_by:   <NAME>
last_modified_date: 3/5/2015
"""

# imports
import constants
import utils
import json
from sql.question import Question
from sql.session import Session

#Format of test case -AM
#requestType: addTestCase
#question: Question
#weight: integer
#content: "string"

def iChooseU(json):
    thisUser = utils.findUser(json)

    question = json["question"]
    theQuestion = Question.get(question["id"])
    weight = json["weight"]
    content = json["content"]

    newTestCase = Test_Case.noID(None, thisUser, theQuestion, weight, content, ACTIVE)
    newTestCase.add()

    return utils.successJson(json)<commit_msg>fixed addTestCase<commit_after>#!/usr/local/bin/python3

"""
created_by:         <NAME>
created_date:       3/5/2015
last_modified_by:   <NAME>
last_modified_date: 3/5/2015
"""

# imports
import constants
import utils
import json
from sql.question import Question
from sql.session import Session

#Format of test case -AM
#requestType: addTestCase
#question: Question
#weight: integer
#content: "string"

def iChooseU(json):
    thisUser = utils.findUser(json)

    question = json["question"]
    theQuestion = Question.get(question["id"])[0]
    weight = json["weight"]
    content = json["content"]

    newTestCase = Test_Case.noID(None, thisUser, theQuestion, weight, content, ACTIVE)
    newTestCase.add()

    return utils.successJson(json)
{'fraction_non_alphanumeric': 0.1183591123066577, 'fraction_numerical': 0.01815736381977135, 'mean_word_length': 4.35251798561151, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1428702', 'n_tokens_mistral': 486, 'n_tokens_neox': 466, 'n_words': 118}