1. Norbert Nemetvolgyi
  2. picaro_activity_id

Commits

Norbert Nemetvolgyi  committed e57cfd6

modified level id conversion to handle 2 digit values

  • Participants
  • Parent commits 9794a20
  • Branches master

Comments (0)

Files changed (2)

File src/ActivityID.php

View file
  • Ignore whitespace
         $hotSpotStr = self::getHotSpotStr($activityID);
         $topicStr = self::getTopicStr($activityID);
 
-        return "L0" . strval(floor((int)$activityID / 60) + 1) . $topicStr . $hotSpotStr;
+        return "L" . str_pad((floor((int)$activityID / 60) + 1), 2, "0", STR_PAD_LEFT) . $topicStr . $hotSpotStr;
     }
 
     /**

File srcTest/ActivityIDTest.php

View file
  • Ignore whitespace
         $actual = ActivityID::toString(61);
         $this->assertEquals("L02M0101", $actual);
     }
+
+    public function testMethod_getActivityString_handlesLevelNumberCorrectlyForInt_541()
+    {
+        $actual = ActivityID::toString(541);
+        $this->assertEquals("L10M0101", $actual);
+    }
 }