Skip to content

Commit 6e2de5b

Browse files
authored
Merge multiple backlogs together (#1840)
We support pulling in issues from multiple backlogs - currently they end up being shown separately (with separate "Setup"/"Mandatory"/... sections). Instead, merge them into one list of issues before rendering.
1 parent 75e3f83 commit 6e2de5b

3 files changed

Lines changed: 58 additions & 61 deletions

File tree

common-theme/layouts/_default/backlog.html

Lines changed: 54 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@
2323
})
2424
</script>
2525

26+
{{ $setupTasks := slice }}
27+
{{ $recurringTasks := slice }}
28+
{{ $mandatoryTasks := slice }}
29+
{{ $optionalTasks := slice }}
30+
2631
{{/* you can have multiple repos but probably for sanity let's just stick with one label filter
2732
for each repo, grab the issues that match the filter
2833
*/}}
2934
{{ range $repos }}
30-
{{ $setupTasks := slice }}
31-
{{ $recurringTasks := slice }}
32-
{{ $mandatoryTasks := slice }}
33-
{{ $optionalTasks := slice }}
3435
{{ $issueBlocks := partial "block/issues-list-as-blocks.html" (dict "backlog" . "backlog_filter" $backlog_filter "path" $currentPath) }}
35-
{{ $repo := . }}
3636
{{ range $issueBlocks }}
3737
{{ $issue := . }}
3838
{{ range .labels.nodes }}
@@ -47,62 +47,58 @@
4747
{{ end }}
4848
{{ end }}
4949
{{ end }}
50-
{{ if lt 0 ($setupTasks | len) }}
51-
<h2>Start Here</h2>
52-
<p>These tasks should be completed before attempting anything else.</p>
53-
{{range $setupTasks}}
54-
{{ partial "block/backlog-issue.html" (dict
55-
"block" .
56-
"Page" $.Page
57-
"Site" site
58-
"repo" $repo
59-
"sprint" $backlog_filter
60-
"path" $currentPath
61-
) }}
62-
{{ end }}
50+
{{ end }}
51+
{{ if lt 0 ($setupTasks | len) }}
52+
<h2>Start Here</h2>
53+
<p>These tasks should be completed before attempting anything else.</p>
54+
{{range $setupTasks}}
55+
{{ partial "block/backlog-issue.html" (dict
56+
"block" .
57+
"Page" $.Page
58+
"Site" site
59+
"sprint" $backlog_filter
60+
"path" $currentPath
61+
) }}
6362
{{ end }}
64-
{{ if lt 0 ($recurringTasks | len) }}
65-
<h2>Recurring Tasks</h2>
66-
<p>These tasks need to be completed in every sprint.</p>
67-
{{range $recurringTasks}}
68-
{{ partial "block/backlog-issue.html" (dict
69-
"block" .
70-
"Page" $.Page
71-
"Site" site
72-
"repo" $repo
73-
"sprint" $backlog_filter
74-
"path" $currentPath
75-
) }}
76-
{{ end }}
63+
{{ end }}
64+
{{ if lt 0 ($recurringTasks | len) }}
65+
<h2>Recurring Tasks</h2>
66+
<p>These tasks need to be completed in every sprint.</p>
67+
{{range $recurringTasks}}
68+
{{ partial "block/backlog-issue.html" (dict
69+
"block" .
70+
"Page" $.Page
71+
"Site" site
72+
"sprint" $backlog_filter
73+
"path" $currentPath
74+
) }}
7775
{{ end }}
78-
{{ if lt 0 ($mandatoryTasks | len) }}
79-
<h2>Mandatory Tasks</h2>
80-
<p>These tasks will help consolidate your learning for this sprint. You should complete as many of these as possible before class on Saturday.</p>
81-
{{range $mandatoryTasks}}
82-
{{ partial "block/backlog-issue.html" (dict
83-
"block" .
84-
"Page" $.Page
85-
"Site" site
86-
"repo" $repo
87-
"sprint" $backlog_filter
88-
"path" $currentPath
89-
) }}
90-
{{ end }}
76+
{{ end }}
77+
{{ if lt 0 ($mandatoryTasks | len) }}
78+
<h2>Mandatory Tasks</h2>
79+
<p>These tasks will help consolidate your learning for this sprint. You should complete as many of these as possible before class on Saturday.</p>
80+
{{range $mandatoryTasks}}
81+
{{ partial "block/backlog-issue.html" (dict
82+
"block" .
83+
"Page" $.Page
84+
"Site" site
85+
"sprint" $backlog_filter
86+
"path" $currentPath
87+
) }}
9188
{{ end }}
92-
{{ if lt 0 ($optionalTasks | len) }}
93-
<h2>Optional Tasks</h2>
94-
<p>These are optional "stretch goals" to attempt when you have finished the mandatory tasks. They may be more challenging or require some additional research.</p>
95-
{{range $optionalTasks}}
96-
{{ partial "block/backlog-issue.html" (dict
97-
"block" .
98-
"Page" $.Page
99-
"Site" site
100-
"repo" $repo
101-
"sprint" $backlog_filter
102-
"path" $currentPath
103-
) }}
104-
{{ end }}
89+
{{ end }}
90+
{{ if lt 0 ($optionalTasks | len) }}
91+
<h2>Optional Tasks</h2>
92+
<p>These are optional "stretch goals" to attempt when you have finished the mandatory tasks. They may be more challenging or require some additional research.</p>
93+
{{range $optionalTasks}}
94+
{{ partial "block/backlog-issue.html" (dict
95+
"block" .
96+
"Page" $.Page
97+
"Site" site
98+
"sprint" $backlog_filter
99+
"path" $currentPath
100+
) }}
105101
{{ end }}
106102
{{ end }}
107-
</article>
103+
</article>
108104
{{ end }}

common-theme/layouts/partials/block/backlog-issue.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<summary class="c-issue__title e-heading__3">
33
{{ .block.name }}
44
<a class="c-issue__link" href="{{ .block.src }}">🔗</a>
5-
<a href="https://curriculum.codeyourfuture.io/api/clone?state={{ dict "issue" .block.number "module" .repo "sprint"
5+
<a href="https://curriculum.codeyourfuture.io/api/clone?state={{ dict "issue" .block.number "module" .block.repo "sprint"
66
.sprint "prevURL" (urls.AbsLangURL .path) | jsonify }}" class="e-button"
77
data-props="{{ .Page.RelPermalink }}">
88
Clone

common-theme/layouts/partials/block/issues-list-as-blocks.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
We did that because PD kept making partially matching labels, but maybe we should be stricter
88
TODO But it means someone has to go round and clean up
99
*/}}
10+
{{ $repo := .backlog }}
1011
{{ $variables := dict
1112
"owner" site.Params.owner
12-
"repo" .backlog
13+
"repo" $repo
1314
}}
1415
{{ $currentPath := .path }}
1516
{{ if .backlog_filter }}
@@ -59,7 +60,7 @@
5960
{{ else }}
6061
{{ with .data.repository.issues.nodes }}
6162
{{ range sort . "title" "asc" }}
62-
{{ $issueBlocks = $issueBlocks | append (dict "name" .title "src" .url "number" .number "labels" .labels) }}
63+
{{ $issueBlocks = $issueBlocks | append (dict "name" .title "src" .url "number" .number "labels" .labels "repo" $repo) }}
6364
{{ end }}
6465
{{ end }}
6566
{{ end }}

0 commit comments

Comments
 (0)