ConDict

Check-in [fd1ef2e7e3]
Login

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

Overview
Comment:add tesinto ticket #063281f6ba
Timelines: family | ancestors | descendants | both | testing
Files: files | file ages | folders
SHA1:fd1ef2e7e378d277279373c81c327d6094f3f7bc
User & Date: zorro 2012-10-03 18:41:21
Context
2012-10-04
18:04
offline translate check-in: d015fb4871 user: zorro tags: testing
2012-10-03
18:41
add tesinto ticket #063281f6ba check-in: fd1ef2e7e3 user: zorro tags: testing
17:57
add debug on/off in config file check-in: 5a802f40f1 user: zorro tags: testing
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to condt.conf.

1
2
3
4
5
6
7
8
[database]
dbname=db.sqlite
# developing mode (on/off, 1/0, yes/no)
debug=no

[user]
default_user=test
test_count=10



|




1
2
3
4
5
6
7
8
[database]
dbname=db.sqlite
# developing mode (on/off, 1/0, yes/no)
debug=yes

[user]
default_user=test
test_count=10

Changes to condt.py.

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
...
666
667
668
669
670
671
672
673
674

























675
676
            self.prer(er)
            print("Error")
        else:
            print("Test successfully finished")
            self.print_test_result(to_save)
        cur.close()

    def print_test_result(self, tests):
        """print test info"""
        right, error = 0, 0
        print("*******YOUR ERRORS********")
        for q in tests:
            if q['error']:
                error += 1
                print("\nQ#{0}: {1}\n[correct] {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:
................................................................................
        except sqlite3.DatabaseError as er:
            self.prer(er)
            print("Error")
        cur.close()
        return 'tetslist'


    def command_testinfo(self, test_id=None):
        pass

























        return 'testinfo'








|


|



|


>
>

|







 







|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>


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
...
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
            self.prer(er)
            print("Error")
        else:
            print("Test successfully finished")
            self.print_test_result(to_save)
        cur.close()

    def print_test_result(self, tests, print_right=False):
        """print test info"""
        right, error = 0, 0
        print("*******YOUR RESULT********")
        for q in tests:
            if q['error']:
                error += 1
                print("Q#{0} (Error): {1}\n[correct] {2}\n[you] {3}\n".format(q['num'],q['question'],q['answer'],q['enter']))
            else:
                right += 1
                if print_right:
                    print("Q#{0}: {1}\n[correct] {2}\n[you] {3}\n".format(q['num'],q['question'],q['answer'],q['enter']))
        print("**************************")
        print("Result: {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:
................................................................................
        except sqlite3.DatabaseError as er:
            self.prer(er)
            print("Error")
        cur.close()
        return 'tetslist'


    def command_testinfo(self, arg=None):
        cur = self.connect.cursor()
        try:
            test_id = int(arg)
            # test info
            sql_list = "SELECT `test`.`id`, `test`.`name`, `test`.`created`, `test`.`finished` FROM `test` WHERE `test`.`user_id`=(?) AND `test`.`id`=(?);"
            cur.execute(sql_list, (self.user_id, test_id))
            test = cur.fetchone()
            if not test:
                print("Empty test")
                return "test_info"
            created = datetime.datetime.strptime(test[2], "%Y-%m-%d %H:%M:%S.%f")
            finished = datetime.datetime.strptime(test[3], "%Y-%m-%d %H:%M:%S.%f")
            print("ID={0}, type: {1}, created: {2}, finished: {3}\n".format(test[0], test[1], created.strftime("%d.%m.%Y %H:%M:%S"), finished.strftime("%d.%m.%Y %H:%M:%S")))
            # results
            cur.execute("SELECT `result`.`number`, `result`.`question`, `result`.`answer`, `result`.`enter`, `result`.`error` FROM `result` WHERE `result`.`test_id`=(?) ORDER BY `result`.`number`;", (test_id,))
            for_print = []
            for row in cur.fetchall():
                for_print.append({'num': row[0], 'question': row[1], 'answer': row[2], 'enter': row[3], 'error': row[4]})
            self.print_test_result(for_print, True)
        except (ValueError, TypeError) as er:
            self.prer(er)
            print("Error, use <.tesinfo ID> (ID - number)")
        except sqlite3.DatabaseError as er:
            self.prer(er)
            print("Error")
        cur.close()
        return 'testinfo'

Changes to db.sqlite.

cannot compute difference between binary files