-
Notifications
You must be signed in to change notification settings - Fork 4
feat(projects): show ready video availability #164
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,6 +41,7 @@ interface ProjectRow { | |
| creator_avatar: string | null; | ||
| creator_admin: number; | ||
| media_count: number; | ||
| has_video: number; | ||
| } | ||
|
|
||
| interface MemberRow { | ||
|
|
@@ -191,6 +192,7 @@ export async function listProjects( | |
| kind?: 'project' | 'idea'; | ||
| groupId?: string; | ||
| search?: string; | ||
| hasVideo?: boolean; | ||
| limit: number; | ||
| offset: number; | ||
| }, | ||
|
|
@@ -210,6 +212,10 @@ export async function listProjects( | |
| bindings.push(options.groupId); | ||
| countBindings.push(options.groupId); | ||
| } | ||
| if (options.hasVideo) { | ||
| conditions.push(readyVideoExistsSql); | ||
| countConditions.push(readyVideoExistsSql); | ||
| } | ||
|
Comment on lines
+215
to
+218
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: The 'Has video' filter for projects is incorrectly applied to the count for ideas, causing the idea count to show 0 when the filter is active. Suggested FixThe Prompt for AI Agent |
||
| let relevanceOrder = ''; | ||
| if (options.search) { | ||
| const escapedSearch = escapeLikePattern(options.search); | ||
|
|
@@ -665,11 +671,18 @@ function projectSelect() { | |
| g.id group_id, g.name group_name, | ||
| u.email creator_email, u.display_name creator_name, | ||
| u.avatar_url creator_avatar, u.is_admin creator_admin, | ||
| (SELECT COUNT(*) FROM media m WHERE m.project_id = p.id AND m.status = 'available') media_count | ||
| (SELECT COUNT(*) FROM media m WHERE m.project_id = p.id AND m.status = 'available') media_count, | ||
| ${readyVideoExistsSql} has_video | ||
| FROM projects p JOIN users u ON u.id = p.creator_id | ||
| LEFT JOIN groups g ON g.id = p.group_id`; | ||
| } | ||
|
|
||
| const readyVideoExistsSql = `EXISTS ( | ||
| SELECT 1 FROM video_submissions video | ||
| WHERE video.project_id = p.id AND video.status = 'ready' | ||
| AND video.retired_at IS NULL AND video.processed_r2_key IS NOT NULL | ||
| )`; | ||
|
|
||
| function mapProject(row: ProjectRow, members: ProjectMember[]): ProjectSummary { | ||
| return { | ||
| id: row.id, | ||
|
|
@@ -696,6 +709,7 @@ function mapProject(row: ProjectRow, members: ProjectMember[]): ProjectSummary { | |
| : null, | ||
| members, | ||
| mediaCount: row.media_count, | ||
| hasVideo: Boolean(row.has_video), | ||
| }; | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.