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

Problem listing groups with "edge count" && "open" filters #1313

Open
bfixowi opened this issue Jan 20, 2025 · 2 comments
Open

Problem listing groups with "edge count" && "open" filters #1313

bfixowi opened this issue Jan 20, 2025 · 2 comments

Comments

@bfixowi
Copy link

bfixowi commented Jan 20, 2025

This switch case (open && edgeCount) uses edge_count = vs. other cases using edge_count<=.

We were previously using open = nil and using edge count = n to find groups with open member slots.

When adding open = true, we now get 0 results because of the edge count equality requirement.

func ListGroups(ctx context.Context, logger *zap.Logger, db *sql.DB, name, langTag string, open *bool, edgeCount, limit int, cursorStr string) (*api.GroupList, error) {
...
	case open != nil && edgeCount > -1:
		// Filtering by open/closed and edge count.
		state := 0
		if !*open {
			state = 1
		}
		params = append(params, state, edgeCount)
		query = `
SELECT id, creator_id, name, description, avatar_url, state, edge_count, lang_tag, max_count, metadata, create_time, update_time
FROM groups
WHERE disable_time = '1970-01-01 00:00:00 UTC'
AND state = $2
AND edge_count = $3`
Copy link

linear bot commented Jan 20, 2025

@bfixowi
Copy link
Author

bfixowi commented Jan 20, 2025

This is currently preventing us from showing only public groups with available slots but we can try to work around this in the runtimes in some way

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

No branches or pull requests

1 participant