From a9b0606b79faa0dfbd4e0b23f04f74540a2aaf92 Mon Sep 17 00:00:00 2001 From: Asaf Gartner Date: Sat, 6 Aug 2022 00:48:56 +0300 Subject: [PATCH] Use new snippet-project association for jam index showcase --- src/website/jam.go | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/website/jam.go b/src/website/jam.go index f01eb20..8247d71 100644 --- a/src/website/jam.go +++ b/src/website/jam.go @@ -14,9 +14,6 @@ import ( func JamIndex2022(c *RequestContext) ResponseData { var res ResponseData - // If logged in, fetch jam project - // Link to project page if found, otherwise link to project creation page with ?jam=1 - daysUntilStart := daysUntil(hmndata.WRJ2022.StartTime) daysUntilEnd := daysUntil(hmndata.WRJ2022.EndTime) @@ -64,16 +61,14 @@ func JamIndex2022(c *RequestContext) ResponseData { return c.ErrorResponse(http.StatusInternalServerError, oops.New(err, "failed to fetch jam projects for current user")) } - jamProjectTags := make([]int, 0, len(jamProjects)) + projectIds := make([]int, 0, len(jamProjects)) for _, jp := range jamProjects { - if jp.Tag != nil { - jamProjectTags = append(jamProjectTags, jp.Tag.ID) - } + projectIds = append(projectIds, jp.Project.ID) } snippets, err := hmndata.FetchSnippets(c, c.Conn, c.CurrentUser, hmndata.SnippetQuery{ - Tags: jamProjectTags, - Limit: 12, + ProjectIDs: projectIds, + Limit: 12, }) if err != nil { return c.ErrorResponse(http.StatusInternalServerError, oops.New(err, "failed to fetch snippets for jam showcase"))