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

Allow working on a flow even when the initial task is done #35

Open
semanser opened this issue Mar 28, 2024 · 2 comments
Open

Allow working on a flow even when the initial task is done #35

semanser opened this issue Mar 28, 2024 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers
Milestone

Comments

@semanser
Copy link
Owner

It should be possible to do a continuous prompting after the initial task is done. This would be useful when the user isn't satisfied with the results or wants to make some improvements.

This code probably needs to be modified:

func processDoneTask(db *database.Queries, task database.Task) error {
flow, err := db.UpdateFlowStatus(context.Background(), database.UpdateFlowStatusParams{
ID: task.FlowID.Int64,
Status: database.StringToPgText("finished"),
})
if err != nil {
return fmt.Errorf("failed to update task status: %w", err)
}
subscriptions.BroadcastFlowUpdated(task.FlowID.Int64, &gmodel.Flow{
ID: uint(flow.ID),
Status: gmodel.FlowStatus("finished"),
Terminal: &gmodel.Terminal{},
})
return nil
}

@semanser semanser added enhancement New feature or request good first issue Good for newcomers labels Mar 28, 2024
@semanser semanser modified the milestones: v.0.1, v.0.2 Mar 28, 2024
@borthdor
Copy link

borthdor commented Apr 3, 2024

Please add that, would change a lot!

@semanser semanser modified the milestones: v.0.2, v0.3 Apr 4, 2024
@wassupjay
Copy link

wassupjay commented Jul 8, 2024

This Does the work

`
func processDoneTask(db *database.Queries, task database.Task) error {

continueFlow := userWantsToContinue(task.FlowID.Int64)

if continueFlow {
	nextTask, err := getNextTask(db, task.FlowID.Int64)

	if err != nil {
		return fmt.Errorf("failed to get next task: %w", err)
	}

	AddCommand(task.FlowID.Int64, *nextTask)
	return nil
}

flow, err := db.UpdateFlowStatus(context.Background(), database.UpdateFlowStatusParams{
	ID:     task.FlowID.Int64,
	Status: database.StringToPgText("finished"),
})

if err != nil {
	return fmt.Errorf("failed to update task status: %w", err)
}
subscriptions.BroadcastFlowUpdated(task.FlowID.Int64, &gmodel.Flow{
	ID:       uint(flow.ID),
	Status:   gmodel.FlowStatus("finished"),
	Terminal: &gmodel.Terminal{},
})
return nil

}
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants