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

Import lurnby web to lurnby self hosted #6

Open
brodokk opened this issue Feb 12, 2022 · 4 comments
Open

Import lurnby web to lurnby self hosted #6

brodokk opened this issue Feb 12, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@brodokk
Copy link

brodokk commented Feb 12, 2022

In a case where a user want to self-host lurnby himself it would be interesting to add the ability to import the data exported from the current website https://www.lurnby.com.

My current use case is that im testing your application and would like to self-host it later.

@Roznoshchik
Copy link
Owner

Roznoshchik commented Feb 12, 2022 via email

@Roznoshchik Roznoshchik changed the title Import feature Import lurnby web to lurnby self hosted Feb 12, 2022
@brodokk
Copy link
Author

brodokk commented Feb 13, 2022

Yeah its actually all data that need to be imported back to a local Lumby. I mean it make more sense that way.

@Roznoshchik
Copy link
Owner

There is one difficult part of this which is that it's not guaranteed that the highlight will be able to keep the reference to it's counterpart in the actual article text.

When you highlight in an article, the actual html content gets updated with a span that shows the highlight. The span is given an id which matches the newly created highlight_id. That's how we know which highlight to open within the actual article.

That's also how we can navigate back to that part of the text when you're viewing a highlight elsewhere and click the go to highlight button. It opens up the article page and navigates to #HIGHLIGHT<highlight_id>

This causes issues when thinking through the import, because it's not guaranteed that you will be importing into a completely blank database. The lurnby database that you might be trying to import the files into, is likely another active installation which means that the highlight_id may not be unique.

If it's not unique, we will need to generate a new highlight_id to proceed with the import. In which case, the link between the highlight and the text will be broken.

@Roznoshchik
Copy link
Owner

Perhaps the issue above isn't so complicated though.

We have

  1. Article text
  2. Original highlight_id
  3. New unique highlight_id

If when importing we determine that a highlight can't be created with the original_id, we create a new highlight id. Then we do a search and replace in the article.text for #Highlight<original_id> replacing it with #Highlight<new_id>

Then the reference stays and we have no issue.

@Roznoshchik Roznoshchik added the enhancement New feature or request label Mar 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants