ConDict

Check-in [84ae69493b]
Login

Check-in [84ae69493b]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:clear db, init new methods
Timelines: family | ancestors | descendants | both | testing
Files: files | file ages | folders
SHA1: 84ae69493b2a3ae290f427b70d570065bb051ec0
User & Date: alzay 2012-10-02 09:18:32.162
Context
2012-10-02
11:30
small lang error check-in: efc81e9a8c user: alzay tags: testing
09:18
clear db, init new methods check-in: 84ae69493b user: alzay tags: testing
2012-09-26
17:59
change urllib check-in: 271f3e45b4 user: zorro tags: testing
Changes
Unified Diff Ignore Whitespace Patch
Changes to condt.conf.
1
2
3
4
5
6
[database]
dbname=db.sqlite

[user]
default_user=zorro
test_count=10




|

1
2
3
4
5
6
[database]
dbname=db.sqlite

[user]
default_user=test
test_count=10
Changes to condt.py.
61
62
63
64
65
66
67




68
69
70
71
72
73
74
            'full': 'quit form program'},
        '.test': {'desc': 'start test (default en)', 'command': None,
            'full': 'start en-ru test'},
        '.testru': {'desc': 'start ru-test', 'command': None,
            'full': 'start ru-en test'},
        '.testmix': {'desc': 'start en-ru test', 'command': None,
            'full': 'start mix test'},




        }
    def __init__(self, name, dbfile, ctest=10):
        super().__init__(name, dbfile)       
        self.__pcounter = 3
        self.ctest = ctest
        self.init_command()
        self.user_id = self.get_user()







>
>
>
>







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
            'full': 'quit form program'},
        '.test': {'desc': 'start test (default en)', 'command': None,
            'full': 'start en-ru test'},
        '.testru': {'desc': 'start ru-test', 'command': None,
            'full': 'start ru-en test'},
        '.testmix': {'desc': 'start en-ru test', 'command': None,
            'full': 'start mix test'},
        '.testinfo': {'desc': 'information by test', 'command': None,
            'full': 'full test information by test ID'},
        '.testlist': {'desc': 'list of tests', 'command': None,
            'full': 'this command print list of your tests'},
        }
    def __init__(self, name, dbfile, ctest=10):
        super().__init__(name, dbfile)       
        self.__pcounter = 3
        self.ctest = ctest
        self.init_command()
        self.user_id = self.get_user()
601
602
603
604
605
606
607

608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
                print("\nQ#{0}: {1}\n[correcnt] {2}\n[you] {3}".format(q['num'],q['question'],q['answer'],q['enter']))
            else:
                right += 1
        print("**************************")
        print("\nResult: {0} error(s) from {1}".format(error,(right + error)))

    def gen_question(self, cur, type_test, alreadyq):

        sql_list = "SELECT `translate`.`id`, `term`.`en`, `translate`.`rus` FROM `translate` LEFT JOIN `term` ON (`translate`.`term`=`term`.`token`) WHERE `translate`.`user_id`=" + str(self.user_id) + " AND (`translate`.`id` NOT IN (" + ", ".join(alreadyq) + "))"
        cur.execute(sql_list)
        for_search = cur.fetchall()
        if not for_search:
            return None, None, None
        row = for_search[random.randint(0,len(for_search)-1)]
        # 0 => en, 1 => ru, 2 => mix
        translate_id = row[0]
        if type_test == 0:
            question, answer = row[1], row[2]
        elif type_test == 1:
            question, answer = row[2], row[1]
        else:
            i = random.randint(1,2)
            j = 1 if i == 2 else 2
            question, answer = row[i], row[j]
        return question, answer, translate_id

    def command_tets(self, arg=None):
        pass

    def command_testinfo(self, test_id=None):
        pass








>


















|





605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
                print("\nQ#{0}: {1}\n[correcnt] {2}\n[you] {3}".format(q['num'],q['question'],q['answer'],q['enter']))
            else:
                right += 1
        print("**************************")
        print("\nResult: {0} error(s) from {1}".format(error,(right + error)))

    def gen_question(self, cur, type_test, alreadyq):
        """genaration question for any test"""
        sql_list = "SELECT `translate`.`id`, `term`.`en`, `translate`.`rus` FROM `translate` LEFT JOIN `term` ON (`translate`.`term`=`term`.`token`) WHERE `translate`.`user_id`=" + str(self.user_id) + " AND (`translate`.`id` NOT IN (" + ", ".join(alreadyq) + "))"
        cur.execute(sql_list)
        for_search = cur.fetchall()
        if not for_search:
            return None, None, None
        row = for_search[random.randint(0,len(for_search)-1)]
        # 0 => en, 1 => ru, 2 => mix
        translate_id = row[0]
        if type_test == 0:
            question, answer = row[1], row[2]
        elif type_test == 1:
            question, answer = row[2], row[1]
        else:
            i = random.randint(1,2)
            j = 1 if i == 2 else 2
            question, answer = row[i], row[j]
        return question, answer, translate_id

    def command_tetlist(self, arg=None):
        pass

    def command_testinfo(self, test_id=None):
        pass

Changes to db.sqlite.

cannot compute difference between binary files

Changes to dict.csv.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
ENGLISH;RUSSIAN
ability;способность
accidentally;случайно
achieve;достижения
appropriate;соответствующие
arrangement;расположение
can you play the guitar?;вы можете играть на гитаре?
compared;по сравнению
congestion;перегруженность
consistency;последовательность
conversation;разговор
decide;решение
derive;извлечь
dialogue;диалог
discuss;обсудить
distinguished names;различающиеся имена
essential;важно
exceed;превышать
exception;исключение
explicit;явный
famous;известный
fashion;мода
gauge;измеритель
guitar;гитара
hi;привет
hierarchical;иерархический
how do you do?;как поживаете?
immediately;немедленно
impose;навязать
in conjuction;в сочетании
inherit;наследовать
interact;взаимодействовать
invoke;ссылаться
judo;дзюдо
lack;недостаток
leaf;лист
mail;почта
mistake;ошибка
objectives;цели
odd;странно
persist;сохраняться
prerequisite;предпосылка
previously;ранее
provisioning;обеспечения
purpose;цель
raise;поднять
represent;представлять
restaurant;ресторан
riding a bike;езда на велосипеде
sailing;парусный спорт
sentences;предложения
shortage;дефицит
skill;мастерство
to belong;принадлежать
together;вместе
vocabulary;словарь
wish list;список пожеланий
password;пароль
|
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
|
<
<
1
2

































3



















4


"ENGLISH";"RUSSIAN"
"ability";"способность"

































"leaf";"лист"



















"vocabulary";"словарь"