diff --git a/common-theme/layouts/_default/backlog.html b/common-theme/layouts/_default/backlog.html index e692bf985..e837b4660 100644 --- a/common-theme/layouts/_default/backlog.html +++ b/common-theme/layouts/_default/backlog.html @@ -29,6 +29,7 @@ {{ $recurringTasks := slice }} {{ $mandatoryTasks := slice }} {{ $optionalTasks := slice }} + {{ $moduleTasks := slice }} {{ $partial := "block/issues-list-as-blocks-github.html"}} @@ -52,6 +53,8 @@ {{ $mandatoryTasks = $mandatoryTasks | append $issue }} {{else if in .name "Optional"}} {{ $optionalTasks = $optionalTasks | append $issue }} + {{else if in .name "Module"}} + {{ $moduleTasks = $moduleTasks | append $issue }} {{ end }} {{ end }} {{ end }} @@ -70,6 +73,19 @@

Start Here

) }} {{ end }} {{ end }} + {{ if lt 0 ($moduleTasks | len) }} +

During this module

+

These tasks can be completed at any point during this module. Don't leave them to the last minute!

+ {{range $moduleTasks}} + {{ partial "block/backlog-issue.html" (dict + "block" . + "Page" $.Page + "Site" site + "sprint" $backlog_filter + "path" $currentPath + ) }} + {{ end }} + {{ end }} {{ if lt 0 ($recurringTasks | len) }}

Recurring Tasks

These tasks need to be completed in every sprint.

diff --git a/common-theme/layouts/partials/block/issues-list-as-blocks-portal.html b/common-theme/layouts/partials/block/issues-list-as-blocks-portal.html index 3dfe8e424..9081d64fb 100644 --- a/common-theme/layouts/partials/block/issues-list-as-blocks-portal.html +++ b/common-theme/layouts/partials/block/issues-list-as-blocks-portal.html @@ -26,23 +26,33 @@ {{ $moduleData := partial "slices/find-by-key.html" (dict "slice" $courseData.modules "key" "name" "target_value" $moduleName "error_template" (printf "Couldn't find module %%s in backlog data from portal for course %s" $courseName)) }} {{ $sprintData := partial "slices/find-by-key.html" (dict "slice" $moduleData.sprints "key" "name" "target_value" $sprintName "error_template" (printf "Couldn't find sprint %%s in backlog data from portal for course %s module %s" $courseName $moduleName)) }} - {{ range $sprintData.backlog_tasks }} - {{ $github_issue_number := int (index (last 1 (split .github_html_url "/")) 0) }} - {{ $labels := dict "nodes" slice }} - {{ if eq .category "mandatory" }} - {{ $labels = dict "nodes" (slice (dict "name" "Core")) }} - {{ else if eq .category "optional" }} - {{ $labels = dict "nodes" (slice (dict "name" "Optional")) }} - {{ else if eq .category "recurring" }} - {{ $labels = dict "nodes" (slice (dict "name" "Recurring")) }} - {{ else if eq .category "setup" }} - {{ $labels = dict "nodes" (slice (dict "name" "Setup")) }} + {{/* + Right now the Portal sets whole-module tasks as an anonymous extra sprint in the sprints list. + We've asked them to set a sibling key to sprints within a module, rather than making a phantom sprint. + TODO: Update this to $moduleData.backlog_tasks when the portal sets this differently. + */}} + {{ $moduleBacklogTasksSprint := partial "slices/find-by-key.html" (dict "slice" $moduleData.sprints "key" "name" "target_value" nil "default" (dict "backlog_tasks" slice)) }} + {{ range $type, $issues := (dict "sprint" $sprintData.backlog_tasks "module" $moduleBacklogTasksSprint.backlog_tasks) }} + {{ range $issue := $issues }} + {{ $github_issue_number := int (index (last 1 (split $issue.github_html_url "/")) 0) }} + {{ $labels := dict "nodes" slice }} + {{ if eq $type "module" }} + {{ $labels = dict "nodes" (slice (dict "name" "Module")) }} + {{ else if eq $issue.category "mandatory" }} + {{ $labels = dict "nodes" (slice (dict "name" "Core")) }} + {{ else if eq $issue.category "optional" }} + {{ $labels = dict "nodes" (slice (dict "name" "Optional")) }} + {{ else if eq $issue.category "recurring" }} + {{ $labels = dict "nodes" (slice (dict "name" "Recurring")) }} + {{ else if eq $issue.category "setup" }} + {{ $labels = dict "nodes" (slice (dict "name" "Setup")) }} + {{ end }} + {{ $time := $issue.time_hours }} + {{ if $time }} + {{ $time = mul $time 60 }} + {{ end }} + {{ $issueBlocks = $issueBlocks | append (dict "name" $issue.title "src" (printf "portal-issue://%s" $issue.github_html_url) "number" $github_issue_number "labels" $labels "repo" $repoName "body" $issue.body "learning_objectives" $issue.learning_outcomes "time" $time "code" $issue.code "submit" $issue.submit "Page" $page) }} {{ end }} - {{ $time := .time_hours }} - {{ if $time }} - {{ $time = mul $time 60 }} - {{ end }} - {{ $issueBlocks = $issueBlocks | append (dict "name" .title "src" (printf "portal-issue://%s" .github_html_url) "number" $github_issue_number "labels" $labels "repo" $repoName "body" .body "learning_objectives" .learning_outcomes "time" $time "code" .code "submit" .submit "Page" $page) }} {{ end }} {{ end }} {{ end }} diff --git a/common-theme/layouts/partials/slices/find-by-key.html b/common-theme/layouts/partials/slices/find-by-key.html index 94bfc764e..18d10ba58 100644 --- a/common-theme/layouts/partials/slices/find-by-key.html +++ b/common-theme/layouts/partials/slices/find-by-key.html @@ -1,7 +1,11 @@ {{ $slice := .slice }} {{ $key := .key }} {{ $target_value := .target_value }} + +{{/* Exactly one of error_template or default should be set */}} {{ $error_template := .error_template }} +{{ $hasDefault := isset . "default" }} +{{ $default := .default }} {{ $found := "PLACEHOLDER_NOT_FOUND_BECAUSE_HUGO_DOES_NOT_ALLOW_NIL" }} @@ -13,7 +17,10 @@ {{ end }} {{ if eq $found "PLACEHOLDER_NOT_FOUND_BECAUSE_HUGO_DOES_NOT_ALLOW_NIL" }} - {{ errorf $error_template $target_value }} + {{ $found = $default }} + {{ if not $hasDefault }} + {{ errorf $error_template $target_value }} + {{ end }} {{ end }} {{/*