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

Work for Marple energy flexibility pilot #78

Merged
merged 31 commits into from
Nov 21, 2024
Merged

Work for Marple energy flexibility pilot #78

merged 31 commits into from
Nov 21, 2024

Conversation

struan
Copy link
Member

@struan struan commented Aug 14, 2024

Things to make the energy flexibility pilot work possible.

Removes the create a team option from the template.

Adds basic functionality to store challenges in the database to make administering this possible without editing the template. Can use either html, plain text or a custom template for the challenge description displayed on the team page. Also uses the challenges to populate the progress scale on the private and public team page.

If there is no challenge set for a Team then it will display thing things in the template as before. If you set a challenge then it will use that, and all the challenges in the database to display progress.

A challenge should have an order which will be used in the progress ladders.

It can be marked as not public in which case it doesn't appear on the non logged in team page.

The description can be one of:

  • plain test in the description in which case it gets split on newlines into paragraphs using the standard django filter
  • if the rich text option is checked then the template spits out the contents of the description as html
  • or have a custom template in which case this is included as the challenge description on the team page. If no template is set then it will fall back to a default template which can be overridden in .env

Fixes #77

struan added 9 commits August 14, 2024 10:33
Used to list the available challenges
used to track the current challenge
Falls back to a hardcoded challenge if it's not there for now
Falls back to hardcoded challenges if none available
to enable descriptions with HTML so you can use a default template for
simplish challenges
falls back to configurable default template if the template is missing
zarino added 3 commits October 4, 2024 10:54
Boring Avatars (quite fairly) charges for their img src API now.
So I’ve ported their JavaScript code to Django-flavoured Python,
so we can render boring avatar SVGs directly into our pages.
Previously, teams only had a centroid point location (calculated from
the postcode of the team’s founder). Now teams can additionally have a
polygon boundary.

The boundary isn’t used for anything yet, and isn’t displayed anywhere
except in the Django Admin – but in the next commit, we’ll use Leaflet
to draw the team’s boundary on the Team page.

Team founders can’t yet define a boundary for their team via the
front-end, but site admins can add a boundary through the Django admin
(drawn by hand on the GeoDjango OSM map, or uploaded as a GeoJSON file).

I’ve included a GeoJSON file for a team in Marple in the fixtures
directory, and a new management command to create the team and import
the boundary from the file.
The Leaflet code we previously used on the local authority "Area" page
has now been expanded to work on Team pages.

If the team has a boundary set, it is displayed on the map. Otherwise,
the map is just centred on the team’s centroid location.

If the user has arrived on the team page after searching for their
postcode on the Search page, then the location of that postcode is also
displayed on the Team map, to make it visually obvious whether you’re
within the team’s boundary or not (if it has one).

We use the OSM HOT map tiles because they’re less visually distracting
than the default "road atlas"-style OSM tiles, and the colours are
coincidentally a better match with the Neighbourhood Warmth branding.

The Leaflet.snogylop plugin dumped at the top of map.js allows us to
shade *outside* the boundary area (rather than the Leaflet default of
only being able to shade inside polygons) making it stand out better.

The user’s last searched-for location is stored in their session.
There is currently no way to clear it (other than deleting the django
session cookie).
zarino added 7 commits October 4, 2024 14:16
If the user has reached a Team page without submitting their postcode
via the homepage / search page, and the team they’re looking at has a
boundary, they can now press the “Am I in this team’s area?” button to
enter their postcode, and plot themselves on the Team page map.
zarino added 5 commits October 4, 2024 14:16
- "My account" page showing user details and linking to deletion form.
- Link to "My account" page from user dropdown menu.
- Dark Matter Labs removed from Privacy Policy as we are no longer in
  the alpha testing period.
- Info about the postcode session storage added to Privacy Policy,
  along with various other small improvements.
- Prevent checkmark icons in team progress sidebar from shrinking
  or growing.
- Make team challenge area narrower (for more readable line lengths)
  and progress sidebar wider.
An unnecessary `else` in `views.py` was causing custom challenge
progress not to be shown on the team page if a user was logged in.
And the challenge names/short_descriptions weren’t being displayed
properly on the progress bar either.

I‘ve also renamed the `challenges` environment variable to
`public_challenges` to make it clear that it doesn’t include the
full list of the team’s current challenges.
The `version` key was deprecated in Docker 25.05. Removing it prevents
Docker from printing warnings when we run the scripts in `/scripts`.
@struan struan merged commit 83dfc48 into main Nov 21, 2024
8 checks passed
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

Successfully merging this pull request may close these issues.

Prep for Carbon Co-op / Marple energy flexibility pilot
2 participants