-
-
Notifications
You must be signed in to change notification settings - Fork 27
Time Tracker
Fernando Correa de Oliveira edited this page Jul 7, 2020
·
2 revisions
model Person { ... }
model Track {
has UInt
model Person { has Str $.name is id; has @.tracks is relationship( *.person-id, :model);
method total { @!tracks.sort(*.time).batch(2).map({ .[1].time - .[0].time }).sum } }
my $*RED-DB = database "SQLite";
Person.^create-table; Track.^create-table;
my $*RED-DEBUG = True;
my \fernando = Person.^create: :name; fernando.tracks.create: :time(now - 2000); fernando.tracks.create: :time(now - 1000); fernando.tracks.create: :time(now - 500); fernando.tracks.create: :time(now);
say fernando.total