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

Split story #237

Open
b3n4kh opened this issue Jun 3, 2024 · 0 comments
Open

Split story #237

b3n4kh opened this issue Jun 3, 2024 · 0 comments
Labels
frontend Vue.js Frontend Task good first issue Good for newcomers

Comments

@b3n4kh
Copy link
Contributor

b3n4kh commented Jun 3, 2024

Implement a button to split an existing story into two.

The user would select one or multiple news items, but not all, at least one news item has to remain.
This would add a button to the AssessSelectionToolbar.vue "spilt story".

On click it would create a new story, containing all selected news items, the remaining news items would remain in the existing story.

On the core side either UnGroupNewsItem could be reused or a new endpoint could be added to assess.py.

Solution could be to adapt remove_news_items_from_story to support creating a single story instead of multiple, or create a method with this functionality with some shared code from it.

    @classmethod
    def remove_news_items_from_story(cls, newsitem_ids: list, user: User | None = None):
        try:
            processed_stories = set()
            for item in newsitem_ids:
                news_item = NewsItem.get(item)
                if not news_item or not user:
                    continue
                if not news_item.allowed_with_acl(user, True):
                    continue
                story = Story.get(news_item.story_id)
                if not story:
                    continue
                story.news_items.remove(news_item)
                processed_stories.add(story)
                cls.create_from_item(news_item)
            # TODO: Change could be something like this.
            # cls.create_from_item(news_item[0])
            # cls.update_stories(processed_stories)
            db.session.commit()
            cls.update_stories(processed_stories)
            return {"message": "success"}, 200
@b3n4kh b3n4kh added the frontend Vue.js Frontend Task label Jun 3, 2024
@b3n4kh b3n4kh changed the title Split cluster Split story Jul 24, 2024
@b3n4kh b3n4kh added the good first issue Good for newcomers label Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend Vue.js Frontend Task good first issue Good for newcomers
Projects
Status: Backlog
Development

No branches or pull requests

1 participant