summaryrefslogtreecommitdiff
path: root/lib/Travelynx/Model
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2022-02-16 20:39:49 +0100
committerDaniel Friesel <derf@finalrewind.org>2022-02-16 20:39:49 +0100
commitef3252863e28905fe96a49a91e5a62c156c69e6e (patch)
treebea7dc3685a41ed86c684f130e6e33f2707d5a43 /lib/Travelynx/Model
parent8f906da9c29fdb63699fbfa4e82deba560b62ca4 (diff)
Traewelling::get: Use named args
Diffstat (limited to 'lib/Travelynx/Model')
-rw-r--r--lib/Travelynx/Model/Traewelling.pm8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Travelynx/Model/Traewelling.pm b/lib/Travelynx/Model/Traewelling.pm
index a334c1d..e05ff7d 100644
--- a/lib/Travelynx/Model/Traewelling.pm
+++ b/lib/Travelynx/Model/Traewelling.pm
@@ -94,11 +94,13 @@ sub unlink {
}
sub get {
- my ( $self, $uid ) = @_;
- $uid //= $self->current_user->{id};
+ my ( $self, %opt ) = @_;
+
+ my $uid = $opt{uid};
+ my $db = $opt{db} // $self->{pg}->db;
my $res_h
- = $self->{pg}->db->select( 'traewelling_str', '*', { user_id => $uid } )
+ = $db->select( 'traewelling_str', '*', { user_id => $uid } )
->expand->hash;
$res_h->{latest_run} = epoch_to_dt( $res_h->{latest_run_ts} );