Skip to content

Activity Graph/Heatmap of Organisation members  #34

@thundergolfer

Description

@thundergolfer

Description

If you go to a Github user's profile page (eg. https://github.com/thundergolfer) you can scroll down to their 'contribution heatmap'.

We want to replicate this graph on the /profiles/<org name>/<member name> pages, but likely only for the past 30 days (github shows the past year).

The library

We can use the https://github.com/wa0x6e/cal-heatmap to achieve this. PR #28 added it in.

Data

The data for this show be available from the data model. A user has Event objects associated with it, so you can do something like user.events. All that you have to do to sort out the data is key the events by their timestamp in seconds with the value of 1. eg:

{ "05390340": 1, 
  "05390998": 1,
  "05947884": 1,
  ...
  "08449333": 1}

see http://cal-heatmap.com/#data-format for more details

Basic Implementation Direction

The cal-heatmap is a javascript library, so it will need to get loaded by rails on page load, and the library will make a call to some endpoint in our app which delivers an application/json payload in the structure above.

The endpoint could quite sensibly sit in profiles_controller.rb as some method like #heatmap that is routed to by /profiles/<org name>/<member name>/heatmap. Too easy.

A small amount of Javascript will get written to customize the heat-map to how we want it.

Note: Currently our /profiles/<org name>/<members name> endpoints return application/json but this will be changed so that they return a view in text/html.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions