Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MT Export/Import] Export/import any tour values #493

Closed
wolfgang-ch opened this issue Mar 23, 2022 · 16 comments
Closed

[MT Export/Import] Export/import any tour values #493

wolfgang-ch opened this issue Mar 23, 2022 · 16 comments
Milestone

Comments

@wolfgang-ch
Copy link
Collaborator

wolfgang-ch commented Mar 23, 2022

Because of using the test version 22.3 in my production which had a fatal error when migrating tour data to the new db version, I need a workflow to export my tours which I created with 22.3 and import it into a backup before version 22.3.

Version 22.3 is postponed, until this feature is available.

This featue is already started in e1b6064

@wolfgang-ch wolfgang-ch added this to the 22.3 milestone Mar 23, 2022
@wolfgang-ch
Copy link
Collaborator Author

@FJBDev I will restructure many <mt: ...> tags in the gpx export file, so you may need to adjust the unit test file(s)

@FJBDev
Copy link
Collaborator

FJBDev commented Mar 23, 2022

I actually wondered for a long time if MT is "symmetric".
i.e.: If I import a tour from FIT to MT then export to GPX. The clears the db (or delete the imported FIT tour) and imports the exported GPX, will this imported tour be the EXACT same as the imported FIT ?
I would hope that it is the same but I never took the time to test.

@wolfgang-ch
Copy link
Collaborator Author

I actually wondered for a long time if MT is "symmetric".

No

There are many fields which are currently not exported into GPX and also some collections and data series, e.g. pulse times

@wolfgang-ch
Copy link
Collaborator Author

Because gpx export/import gets more and more complicated when all MT fields are also integrated, I just decided to create the new export file extension .mt and it's file has it's own xml tags

@wolfgang-ch wolfgang-ch changed the title [GPX Export/Import] Export/import any tour values [MT Export/Import] Export/import any tour values Mar 24, 2022
@FJBDev
Copy link
Collaborator

FJBDev commented Mar 25, 2022

What about .mtx since it's mainly based off the gpx format ?

@wolfgang-ch
Copy link
Collaborator Author

What about .mtx since it's mainly based off the gpx format ?

Which ?

image

@FJBDev
Copy link
Collaborator

FJBDev commented Mar 25, 2022

Which ?

The number 10 😄

Also, now that JSON is getting very popular and more "modern" compared to XML (which is getting old and verbose), you could inspire yourself from those files for the MT format ?

See GeoJSON as an example that seems to be widely used these days (CalTopo by default uses GeoJSON)

@wolfgang-ch
Copy link
Collaborator Author

wolfgang-ch commented Mar 26, 2022

After I restarted this features a second time by using a StAX parser, for now I will stay with it.

now that JSON is getting very popular and more "modern"

I learned JSON in 2004 (or earlier) as an easy mechanism to transfer data from the server to the browser and with the JS eval(...) method you could convert the JSON text into JS objects

https://web.archive.org/web/20030205013518/http://crockford.com/JSON/js.html

image

image

In the first version in 2002 we may also be already using JSON but I cannot remember it. There is a video from the 2002 presentation https://www.youtube.com/watch?v=Qs0K8zaVzZ8

image

@wolfgang-ch
Copy link
Collaborator Author

After comparing .mt export files from the db with the fatal migration error and with the .mt import/export files from the fixed db, all .mt files had the same content except the entity ID's and modified data.

I checked any import/export fields in the code but it could still be possible, that there may be fields which are not exported/imported correctly because I had not tested any possible fields, just the one I'm using in about 10 tour files.

When using this feature to export/import .mt files, it should always be used with care and backups are strongly recommended

@wolfgang-ch
Copy link
Collaborator Author

To identify the methods, which were added to get/set entity values for the MT export/import, all method comments have the tag "Used for MT import/export".

These methods should not be used because of possible side effects, there are other methods to set/get entity fields, this was the reason to tag these methods.

@wolfgang-ch
Copy link
Collaborator Author

wolfgang-ch commented Mar 30, 2022

Workflow to fix the possible migration error.

  • Install MT 22.3
  • Start MT
  • Export all tours, with the format "MyTourbook (.mt)", which were created with the MT22.3 test version
  • Exit MT
  • Replace "derby-database" folder with the same backup folder
  • Start MT
  • Import .mt files and save the tours

@FJBDev
Copy link
Collaborator

FJBDev commented Mar 30, 2022

Workflow to fix the possible migration error.

Or what I did (another simple solution that didn't need a new file format) was to restore my backup before the MT22.3 test version and re-import my 10-15 new tours with the original files (.fit).

@wolfgang-ch
Copy link
Collaborator Author

Workflow to fix the possible migration error.

Or what I did (another simple solution that didn't need a new file format) was to restore my backup before the MT22.3 test version and re-import my 10-15 new tours with the original files (.fit).

This is the other option but you loose all your comments, markers and photos which you've created/assigned.

I just updated the info which code should be updated, when the db data structure is modified 63aa346

@FJBDev
Copy link
Collaborator

FJBDev commented Mar 31, 2022

This is the other option but you loose all your comments, markers and photos which you've created/assigned.

Indeed, but in my case, I had none of those as I had just imported FIT files and not added comments, markers yet

I actually wondered for a long time if MT is "symmetric".

Is the .mt import/export symmetric then ?

@wolfgang-ch
Copy link
Collaborator Author

Is the .mt import/export symmetric then ?

Almost, today it occurred to me that I have not yet tested reference tours but tour comments, markers and photos are working

@wolfgang-ch
Copy link
Collaborator Author

All discovered issues are now fixed in 089ac34

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants