aricneto / TwistyTimer

Twisty Timer is a material design twisty puzzle timer for Android. It uses the TNoodle library to generate scramble sequences for all current official speedsolving puzzles.
GNU General Public License v3.0
238 stars 52 forks source link

Import with some annoying behaviours #154

Open Domalar opened 4 years ago

Domalar commented 4 years ago

I have some issues about the import.

  1. Import of invalid cubes is possible

I imported this lines: "3x3";"Mini";"58750";"1591282373000";"";"0";"" "3x3";"Mini";"64360";"1591282383000";"";"0";"" "3x3";"Mini";"29320";"1591282393000";"";"0";"" "3x3";"Mini";"89340";"1591282403000";"";"0";"" "3x3";"Mini";"31220";"1591282413000";"";"0";""

Instead of "333" I had "3x3". My mistake! But Twisty showed a message that 5 solves were imported. But this 5 solves are not visible anywhere because 3x3 is no valid cube!

  1. Following issue to point 1: This scrambles are in the twisty database. If I export the DB the 5 scrambles with "3x3" are also exported but I do not find a way to get rid of them! Would be good to have a simple "delete all" before importing a backup (see point 5)

  2. Import goes always into the archive. This is annoying! I want all imports in the normal session because I import every week 75 solves (15 different events (3x3 OH, 3x3 BLD aso.)) and every time I have to use "Dearchive" 15 times! Maybe a setting "Import to archive or session" or a checkbox in the import dialog?

  3. Import sometimes imports duplicates Once I exported my whole database and just added many comments and scrambles in the backup file. I can ensure that I do not have changed timestamps!

Then imported the file again and I would have expected that only the existing solves would be updated. But after that I had some duplicates! I don't know why? Maybe I do not understand the matching. I deleted all solves and imported again (with 35 times "Delete all" and 35 times "Dearchive") to fix it.

  1. There is no easy way to remove all solves (eg. for importing everything again after editing in the backup like described in point 4. A function in the settings would help. Maybe with 2 security questions and typeing "YES I WILL" to ensure it is not used I not really wanted.
Domalar commented 4 years ago

Investigated a little bit and found some things in the code!

  1. Import invalid cubes: app/src/main/java/com/aricneto/twistytimer/activity/MainActivity.java:1045 Here just the string is taken

app/src/main/java/com/aricneto/twistytimer/database/DatabaseHandler.java:309 And here in this method the string is just used. In PuzzleUtil there are static string fields with the cube types. Why not check the type against this valid cubes types?

  1. The Archive is fixed set to "true" app/src/main/java/com/aricneto/twistytimer/activity/MainActivity.java:1046 It would be possible to take a setting here where to import. Archive or not.

  2. The import sometimes duplicates the times. app/src/main/java/com/aricneto/twistytimer/database/DatabaseHandler.java:720 Reason found: The scramble is part of the compare. Why?

I sometimes use Twisty to competite eg. in Swiss Home Alone. And after the competition I would like to add all the scrambles in the exported textfile (by PC Editor) and then update the times in Twisty. This is not possible. I think the type, subtype, date and time should be enough!

If you want I can try to make some of this changes and contribute the code but at the moment I have compile problems with AndroidStudio. First many resources were not found (eg. twisty_pattern in background_gradient.xml) and after just changing all missing resources to something different there is a next error with CSVReader?

D:\develop\Twisty\app\src\main\java\com\aricneto\twistytimer\activity\MainActivity.java:1035: error: no suitable constructor found for CSVReader(BufferedReader,char,char,boolean) CSVReader csvReader = new CSVReader(br, ';', '"', true); ^ constructor CSVReader.CSVReader(Reader) is not applicable (actual and formal argument lists differ in length) constructor CSVReader.CSVReader(Reader,int,ICSVParser,boolean,boolean,int,Locale,LineValidatorAggregator,RowValidatorAggregator,RowProcessor) is not applicable (actual and formal argument lists differ in length)