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

Replace weighted_sort #3973

Open
2 tasks
Tracked by #3864
beechnut opened this issue Jul 10, 2024 · 2 comments
Open
2 tasks
Tracked by #3864

Replace weighted_sort #3973

beechnut opened this issue Jul 10, 2024 · 2 comments
Assignees

Comments

@beechnut
Copy link
Contributor

beechnut commented Jul 10, 2024

Currently, projects have a weight attribute. This may have been used across the site at some point, but presently it's used in a single place: /our-work.

The effect of weighting projects and having a weighted sort is that it effectively pins certain projects.

The implementation is overly complex for the effect. But we do need the effect to remain consistent — the migration should result in no visible content changes.

I suspect the right way to do this is to:

  • for the 6 projects with the highest weights, replace with pin: {rank, 1 being highest}
  • run a pre-build validation that there are 6 pinned projects with unique numbers
  • remove all other weight: attributes from the code
  • update template code in /our-work to render all this correctly

Acceptance criteria

@beechnut beechnut changed the title Replace weighted Replace weighted_sort Jul 10, 2024
@beechnut beechnut self-assigned this Jul 10, 2024
@edwintorres
Copy link
Member

We're doing prioritization. We want to understand the impact of this issue.

@beechnut
Copy link
Contributor Author

beechnut commented Sep 27, 2024

Okay so. This might be hard to explain in a single comment, but I'll give it a try.

EDIT: As far as impact — this will be important when we want to change the featured projects. Until then, not that important.

In the Jekyll site, there was a thing called weighted_sort that showed our six "most impactful" projects on /our-work, based off a per-project impact score called project_weight. But we don't sort ALL the projects by impact, we're just showing 6, so a whole scoring system for all our projects just to show a handful is over-engineering what could be a simple solution.

When we removed the weighted sorting algorithm, it didn't actually change which projects came out on top. The same projects are displayed.

For now.

But, as we add and remove projects over time, we will want to change which six projects we feature.

The work here should be, roughly, the following:

  1. Remove the project_weight attribute from everything in content/projects/services/
  2. Add pin: { number 1 through 6 } to the six pages currently being featured, for example, adding pin: 1 to projects/services/forest-service.md. The pin number would be the position in which the project appears in the featured project list in /our-work.
  3. If possible, adding a validation that there are 6 project pages with unique numbers 1–6, and halting the build if not. This would prevent adding too many or too few pinned projects, and would require a specific order.
  4. Change the project rendering in /our-work to:
-{% for case_study in featured.case_studies %}
-  {% assign project = collections.services | where: "data.agency", case_study.agency | first %}
-    {% include "card-project.html" project: project %}
+{% for project in collections.services | where: "data.pin" %} // or something like that
+    {% include "card-project.html", project: project %}

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

3 participants