learningequality / learningequality/studio
Restore the `published` field and content database when restoring a deleted channel
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 191
- Forks
- 307
- Avg merge
- 5d 6h
- Merged PRs (30d)
- 10
Description
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Overview
When a channel is deleted and then restored, the channel published's state is not fully recovered
Current Behavior
-
When a channel is deleted:
- The channel
main_tree.publishedfield is set to false - Main content database (
{channel_id}.sqlite3) is removed
- The channel
-
When a channel is restored:
- The channel is restored just by setting its
deletedfield to false, but none of the publish stat is recovered (although theversionfield is still set).
- The channel is restored just by setting its
This creates inconsistencies because after a channel is deleted and then restored, its version field is set, but its main_tree.published is false.
Technical details
When restoring a deleted channel channel.version > 0, we should:
- Restore the
main_tree.publishedfield to true. - Restore the main content database in a background task:
- Copy the latest versioned database
{channel_id}_{version}.sqlite3to become the main database{channel_id}.sqlite3. Similarly to what we do on the ensure_versioned_database_exists, but in the other direction.
- Copy the latest versioned database
Acceptance Criteria
- When a deleted channel is restored, its
main_tree.publishedfield is automatically set to true - A background task is created to restore the main content database
🤖 This issue was written with AI assistance, under supervision, review, and final edits by @AlexVelezLl 🤖
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
This issue is marked as not open for contribution. If work proceeds, inspect the channel deletion and restoration logic in contentcuration/models.py, then compare it with ensure_versioned_database_exists in contentcuration/utils/publish.py. Done means restoration sets main_tree.published to true and creates a background task that restores the main content database.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, sqlite
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 30/100