Sixth update – Progress

36Screen
The main menu

I’ve been gaining a lot of motivation from using Trello and my Changelog script, which has culminated in finally creating the dreaded “Main Menu”, albeit with missing menu items. In the ~13 years I’ve been programming, I’ve created maybe 3 main menus. Needless to say, I consider this a great success.

Making a point system for my tasklist on Trello (easy=1, medium=2, hard=3) and automating the report has helped immensely. I’m now somewhat able to quantify my progress and it feels extremely satisfying putting tasks in the done list. It feels like a game. It has the added bonus of giving me a more precise way of predicting milestones, by comparing how many points I’m getting per week and comparing with how many point are left.

Here’s the PHP script that generates the changelog. It requires labels named ‘Easy’, ‘Medium’ and ‘Hard’ and your cards should all be labeled. It also requires a list in which you put all the cards/tasks that are done.

$key = "Your Trello API key";
$listID = "The ID of your done list";
$data =file_get_contents("https://api.trello.com/1/lists/$listID/cards?actions=updateCard&fields=name,url,labels&key=$key");
$json = json_decode($data);
$cards = array();
foreach ($json as $card)
  {
  foreach ($card--->actions as $action)
    {
    if (isset($action->data->listAfter) && $action->data->listAfter->id==$listID)
      {
      $cards[] = (object) Array(
      'name'=>$card->name,
      'labels'=>$card->labels,
      'dateLastActivity'=>$action->date,
      'url'=>$card->url
      );
      }
    }
  }
$grouped = array();
$points = array();
$labelpoints = array(
  'Easy'=>1,
  'Medium'=>2,
  'Hard'=>3,
);
$fontsizes = array(
  'Easy'=>'75%',
  'Medium'=>'100%',
  'Hard'=>'150%',
);
$fontcolors = array(
  'Easy'=>'#00DD00',
  'Medium'=>'#DDAA00',
  'Hard'=>'#DD0000',
);
foreach ($cards as $card)
  {
  $date = new DateTime($card->dateLastActivity);
  $id = $date->format("\W\\e\\e\k W, Y");
  $day = $date->format("l");
  $grouped[$id][$day][] = $card;
  $points[$id][$day][] = count($card->labels>0)?$labelpoints[$card->labels[0]->name]:0;
  }
krsort($grouped);
foreach ($grouped as $date => $day)
  {
  $point = array_sum(array_map(function ($x) {return array_sum($x);},$points[$date]));
  echo "

<h2>$date ($point)</h2>

<ul>";
  foreach ($day as $dd =&gt; $group)
    {
    $point = array_sum($points[$date][$dd]);
    echo "

   <li>$dd ($point)</li>

<ul>";
    foreach ($group as $card)
      {
      $size = count($card-&gt;labels&gt;0)?$fontsizes[$card-&gt;labels[0]-&gt;name]:'100%';
      $color = count($card-&gt;labels&gt;0)?$fontcolors[$card-&gt;labels[0]-&gt;name]:'black';
      echo "

   <li><a style="font-size:$size;color:$color;" href="$card->url">$card-&gt;name</a></li>

";
      }
    echo "</ul>

";
    }
    echo "</ul>

";
  }