rmit-programming-club/network-vis

Activity Graph/Heatmap of Organisation members

thundergolfer opened this issue · 1 comments

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.

See https://github.com/rmit-programming-club/network-vis/wiki/Page-Mockups for a sketch mockup of the /profiles/<org name>/<members name> page