[Getan-commits] [PATCH 1 of 2] dd getan testdata, add multi-selection Bug report
Wald Commits
scm-commit at wald.intevation.org
Thu Jan 18 11:30:11 CET 2018
# HG changeset patch
# User Magnus Schieder <mschieder at intevation.de>
# Date 1516270464 -3600
# Node ID 7125e67d5acb79fa2679caa358fa0cbd98193ab6
# Parent f441913a5cdc45a721ae6babcb6201353dd250b7
dd getan testdata, add multi-selection Bug report.
* add /test_data/getan_test_data.py to create a new getan database
with test data.
* update report 20170317 BER. Add a guide to recreating the bug.
* TDOD: Fix the bug.
diff -r f441913a5cdc -r 7125e67d5acb TODO
--- a/TODO Thu Jan 04 10:59:19 2018 +0100
+++ b/TODO Thu Jan 18 11:14:24 2018 +0100
@@ -1,3 +1,61 @@
+
+20180117 Magnus Schieder
+
+ 20170317 BER: Reproduce and then fix a defect that it is surprising which
+ entries are moved by `m` or deleted by 'd'.
+ It probably has to do how multi-selection are handled. Maybe they
+ are not cleared properly at the end of an operation.
+ One description: It happens when you have changed a lot of entries
+ from different projects (I assume), e.g. by editing the description,
+ the length or timedate and then use move where you intend to only move
+ one, the unwanted result is several moved entries.
+
+ Update:
+ getan 2.1
+
+ Creating a new database with test data:
+
+ 1) Delete getan_test_data.db if it already exists to create a new database.
+ 2) Execute getan_test_data.py to get the test database getan_test_data.db.
+ (getan/test_data/getan_test_data.py)
+
+- Bug 1.0
+ 2) Open getan with the test database. (getan /path/getan_test_data.db)
+ 3) Switch to the entries from the project pro1 with tab.
+ 4) Mark with return and arrow keys ent1 and ent2.
+ 5) Go back to the projects with tab.
+ 6) Switch back to the entries of project pro1.
+ 7) Mark this time ent3 and ent4.
+ 8) Press m, then 3 and then y to move ent3 and ent4 to pro3.
+
+ Expectation:
+ ent3 and ent4 are moved to pro3.
+
+ Result:
+ ent1, ent2, ent3 and ent4 were moved to pro3.
+
+- Bug 1.1
+ Execute 1) to 7) from 1.0.
+ 8) Press d to delete ent3 and ent4.
+
+ Expectation:
+ ent3 and ent4 are deleted.
+
+ Result:
+ ent1, en2, ent3 and ent4 are deleted.
+
+- Bug2
+ Execute 1) to 4) from 1.0.
+ 5) Press m.
+ 6) Now also mark ent3 and pro ent4.
+ 7) Press 3 and then y to move ent1, ent2, ent3 and ent4 to pro3.
+
+ Expectation:
+ After pressing m, you can not mark additional entries.
+
+ Result:
+ Only ent1 and ent2 are moved, though all are selected.
+
20180104 BER (minor) Display licensing information with --version and
usage. Implementation idea: change this when moving away from optparse.
@@ -10,14 +68,7 @@
20170504 BER: Some multi-user installations do not want a logfile by default.
We could solve this requirement by making it configurable.
-20170317 BER: Reproduce and then fix a defect that it is surprising which
- entries are moved by `m` or deleted by 'd'.
- It probably has to do how multi-selection are handled. Maybe they
- are not cleared properly at the end of an operation.
- One description: It happens when you have changed a lot of entries
- from different projects (I assume), e.g. by editing the description,
- the length or timedate and then use move where you intend to only move
- one, the unwanted result is several moved entries.
+
20160912 BER: Better code: states.py: classes EditEntryState and
AdjustEntryState have same methods exit() and set_focus(), maybe join them?
diff -r f441913a5cdc -r 7125e67d5acb test_data/getan_test_data.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test_data/getan_test_data.py Thu Jan 18 11:14:24 2018 +0100
@@ -0,0 +1,73 @@
+#!/usr/bin/env python3
+#
+# Author: Magnus Schieder <magnus.schieder at intevation.de>
+# (c) 2018 Intevation GmbH
+#
+# Program to create test data for getan (getan_test_data.db).
+# Please delete existing getan_test_data.db.
+# Open getan with getan_test_data.db: getan /path/getan_test_data.db
+#
+# This is Free Software licensed under the terms of GPLv3 or later.
+# For details see LICENSE coming with the source of 'getan'.
+#
+
+
+import sqlite3
+
+
+def main():
+
+ conn = sqlite3.connect("getan_test_data.db")
+
+ db = conn.cursor()
+
+ # create getan schema.
+ db.execute('''CREATE TABLE projects (
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
+ key VARCHAR(16) NOT NULL CONSTRAINT unique_key UNIQUE,
+ description VARCHAR(256),
+ active BOOLEAN DEFAULT 1)
+ ''')
+
+ db.execute('''CREATE TABLE entries (
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
+ project_id INTEGER REFERENCES projects(id),
+ start_time TIMESTAMP NOT NULL,
+ stop_time TIMESTAMP NOT NULL,
+ description VARCHAR(256),
+
+ CHECK (strftime('%s', start_time) <= strftime('%s', stop_time)))
+ ''')
+
+ # List of projects.
+ # (key, 'description')
+ pro = [
+ (1, 'pro1'),
+ (2, 'pro2'),
+ (3, 'pro3'),
+ ]
+
+ # List of entries with test data.
+ # (project_id, 'start_time', 'stop_time', 'description')
+ ent = [
+ (2, '2018-01-01 01:01:01.0', '2018-01-01 02:01:01.0', 'ent9'),
+ (2, '2018-01-01 01:01:01.0', '2018-01-01 02:01:01.0', 'ent8'),
+ (2, '2018-01-01 01:01:01.0', '2018-01-01 02:01:01.0', 'ent7'),
+ (1, '2018-01-01 01:01:01.0', '2018-01-01 02:01:01.0', 'ent6'),
+ (1, '2018-01-01 01:01:01.0', '2018-01-01 02:01:01.0', 'ent5'),
+ (1, '2018-01-01 01:01:01.0', '2018-01-01 02:01:01.0', 'ent4'),
+ (1, '2018-01-01 01:01:01.0', '2018-01-01 02:01:01.0', 'ent3'),
+ (1, '2018-01-01 01:01:01.0', '2018-01-01 02:01:01.0', 'ent2'),
+ (1, '2018-01-01 01:01:01.0', '2018-01-01 02:01:01.0', 'ent1'),
+ ]
+
+ db.executemany("INSERT INTO projects(key, description) VALUES (?,?)", pro)
+
+ db.executemany('''INSERT INTO entries(project_id, start_time, stop_time,
+ description) VALUES (?,?,?,?)''', ent)
+
+ conn.commit()
+ conn.close()
+
+if __name__ == '__main__':
+ main()
More information about the Getan-commits
mailing list