Skip to content

Commit 2db06ce

Browse files
committed
convert single to find or first.
1 parent 141026a commit 2db06ce

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+241
-280
lines changed

bin/clean_up_empires.pl

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686

8787
out('Updating Viral Log');
8888
my $viral_log = $db->resultset('Lacuna::DB::Result::Log::Viral');
89-
my $add_deletes = $viral_log->search({date_stamp => format_date($start,'%F')},{rows=>1})->single;
89+
my $add_deletes = $viral_log->search({date_stamp => format_date($start,'%F')})->first;
9090
unless (defined $add_deletes) {
9191
$add_deletes = $viral_log->new({date_stamp => format_date($start,'%F')})->insert;
9292
}
@@ -98,7 +98,7 @@
9898
});
9999
my $cache = Lacuna->cache;
100100
my $create_date = format_date($start->clone->subtract(hours => 1),'%F');
101-
my $add_creates = $viral_log->search({date_stamp => $create_date},{rows=>1})->single;
101+
my $add_creates = $viral_log->search({date_stamp => $create_date})->first;
102102
unless (defined $add_deletes) {
103103
$add_creates = $viral_log->new({date_stamp => $create_date})->insert;
104104
}

bin/cult/add_colonies.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
my $test;
5050
do {
5151
$test = $db->resultset('Lacuna::DB::Result::Map::Body')->search({
52-
name => $pname })->single;
52+
name => $pname })->first;
5353
if ($test) {
5454
$orbit++;
5555
$pname = $planet->star->name." ".$orbit;

bin/delambert/add_colonies.pl

+2-2
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@
176176
class => {-like => ['%Planet::GasGiant::G%','%:Planet::P%']},
177177
-and => [size => {'>=' => $sizes->{$level}[0]}, size => {'<' => $sizes->{$level}[1] }],
178178
orbit => {'<' => 8},
179-
},{rows=>1})->single;
179+
})->first;
180180
next STAR if not $body;
181181
out("Putting colony in star system ".$star->name);
182182
last STAR;
@@ -240,7 +240,7 @@ sub create_empire {
240240
size => { '>=' => 110},
241241
zone => $zone,
242242
empire_id => undef,
243-
},{rows=>1})->single;
243+
})->first;
244244

245245
$empire->insert;
246246
$home->delete_buildings(@{$home->building_cache});

bin/draw_star_map.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
for (my $y = 15; $y > -15; $y--) {
1010
foreach (my $x = 15; $x > -15; $x--) {
1111
my $star = $stars->search({x=>$x, y=>$y})->count;
12-
my $body = $bodies->search({x=>$x, y=>$y},{rows=>1})->single;
12+
my $body = $bodies->search({x=>$x, y=>$y})->first;
1313
if ($star) {
1414
print "*";
1515
}

bin/lacuna.psgi

+2-2
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ my $app = builder {
243243
enable "Auth::Basic", authenticator => sub {
244244
my ($username, $password) = @_;
245245
return 0 unless $username;
246-
my $empire = Lacuna->db->resultset('Lacuna::DB::Result::Empire')->search({name => $username, is_admin => 1},{rows=>1})->single;
246+
my $empire = Lacuna->db->resultset('Lacuna::DB::Result::Empire')->search({name => $username, is_admin => 1})->first;
247247
return 0 unless defined $empire;
248248
return $empire->is_password_valid($password);
249249
};
@@ -254,7 +254,7 @@ my $app = builder {
254254
enable "Auth::Basic", authenticator => sub {
255255
my ($username, $password) = @_;
256256
return 0 unless $username;
257-
my $empire = Lacuna->db->resultset('Lacuna::DB::Result::Empire')->search({name => $username, is_mission_curator => 1},{rows=>1})->single;
257+
my $empire = Lacuna->db->resultset('Lacuna::DB::Result::Empire')->search({name => $username, is_mission_curator => 1})->first;
258258
return 0 unless defined $empire;
259259
return $empire->is_password_valid($password);
260260
};

bin/mission_check.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
out('Loading DB');
3535
our $db = Lacuna->db;
3636

37-
my $emp = $db->resultset('Empire')->search({id => $empire_id})->single;
37+
my $emp = $db->resultset('Empire')->find($empire_id);
3838

3939
die "No empire with id:$empire_id found\n" unless $emp;
4040

bin/saben/create_colony.pl

+2-3
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@
3434

3535
out('Finding colony...');
3636
my $body = $db->resultset('Lacuna::DB::Result::Map::Body')->search(
37-
{ zone => $target_player->home_planet->zone, empire_id => undef, size => { between => [30,35]}},
38-
{ rows => 1 }
39-
)->single;
37+
{ zone => $target_player->home_planet->zone, empire_id => undef, size => { between => [30,35]}}
38+
)->first;
4039
die 'Could not find a colony to occupy.' unless defined $body;
4140
say $body->name;
4241

bin/saben/create_colony2.pl

+2-3
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@
3636
my $bodies = $db->resultset('Lacuna::DB::Result::Map::Body');
3737
my $target_home = $target_player->home_planet;
3838
my $body = $bodies->search(
39-
{ x => {between => [ $target_home->x - 25, $target_home->x + 25 ]}, y => { between => [ $target_home->y - 25, $target_home->y + 25 ] }, empire_id => undef, size => { between => [30,35]}},
40-
{ rows => 1 }
41-
)->single;
39+
{ x => {between => [ $target_home->x - 25, $target_home->x + 25 ]}, y => { between => [ $target_home->y - 25, $target_home->y + 25 ] }, empire_id => undef, size => { between => [30,35]}}
40+
)->first;
4241
die 'Could not find a colony to occupy.' unless defined $body;
4342
say $body->name;
4443

bin/saben/create_colony3.pl

+2-3
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@
3636
my $bodies = $db->resultset('Lacuna::DB::Result::Map::Body');
3737
my $target_home = $target_player->home_planet;
3838
my $body = $bodies->search(
39-
{ x => {between => [ $target_home->x - 25, $target_home->x + 25 ]}, y => { between => [ $target_home->y - 25, $target_home->y + 25 ] }, empire_id => undef, size => { between => [30,35]}},
40-
{ rows => 1 }
41-
)->single;
39+
{ x => {between => [ $target_home->x - 25, $target_home->x + 25 ]}, y => { between => [ $target_home->y - 25, $target_home->y + 25 ] }, empire_id => undef, size => { between => [30,35]}}
40+
)->first;
4241
die 'Could not find a colony to occupy.' unless defined $body;
4342
say $body->name;
4443

bin/saben/create_empire.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
out('Find home planet...');
5050
my $bodies = $db->resultset('Lacuna::DB::Result::Map::Body');
5151
my $zone = $bodies->get_column('zone')->max;
52-
my $home = $bodies->search({size => 35, zone => $zone },{rows=>1})->single;
52+
my $home = $bodies->search({size => 35, zone => $zone })->first;
5353
$empire->insert;
5454
$empire->found($home);
5555

bin/saben/orig_send_attack.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ sub start_attack {
130130
);
131131
return $attack, $timer;
132132
}
133-
my $probe = $ships->search({body_id => $saben_colony->id, type => 'probe', task=>'Docked'},{rows => 1})->single;
133+
my $probe = $ships->search({body_id => $saben_colony->id, type => 'probe', task=>'Docked'})->first;
134134
if (defined $probe) {
135135
out('Has a probe to launch for '.$target_colony->name.'...');
136136
$probe->send(target => $target_colony->star);

bin/summarize_economy.pl

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@
5555
sub summarize {
5656
my $date = shift;
5757
out('Summarizing Economy For '.$date->ymd);
58-
my $today = $economy_log->search({date_stamp => $date->ymd},{rows=>1})->single;
58+
my $today = $economy_log->search({date_stamp => $date->ymd})->first;
5959
if (defined $today) {
6060
$today->delete;
6161
}
6262
$today = $economy_log->new({ date_stamp => $date->ymd });
63-
my $viral = $viral_log->search({date_stamp => $date->ymd},{rows=>1})->single;
63+
my $viral = $viral_log->search({date_stamp => $date->ymd})->first;
6464
if (defined $viral) {
6565
$today->total_users($viral->total_users);
6666
}

bin/summarize_server.pl

+3-3
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ sub summarize_alliances {
262262
$alliance_data{offense_success_rate} /= $alliance_data{member_count};
263263
$alliance_data{defense_success_rate} /= $alliance_data{member_count};
264264
}
265-
my $log = $logs->search({alliance_id => $alliance->id},{rows=>1})->single;
265+
my $log = $logs->search({alliance_id => $alliance->id})->first;
266266
if (defined $log) {
267267
if ($alliance_data{member_count}) {
268268
$log->update(\%alliance_data);
@@ -367,7 +367,7 @@ sub summarize_empires {
367367
{defense_success_rate} = $empire_data{defense_success_rate} / $empire_data{colony_count};
368368
}
369369
$empire_data{empire_size} = $empire_data{colony_count} * $empire_data{population};
370-
my $log = $logs->search({empire_id => $empire->id},{rows=>1})->single;
370+
my $log = $logs->search({empire_id => $empire->id})->first;
371371
if (defined $log) {
372372
$empire_data{colony_count_delta} = $empire_data{colony_count} - $log->colony_count + $log->colony_count_delta;
373373
$empire_data{empire_size_delta} = ($empire_data{colony_count_delta}) ? $empire_data{colony_count_delta} * $empire_data{population_delta} : $empire_data{population_delta};
@@ -423,7 +423,7 @@ sub summarize_colonies {
423423
my $spy_logs = $db->resultset('Log::Spies');
424424
while (my $planet = $planets->next) {
425425
out($planet->name);
426-
my $log = $logs->search({planet_id => $planet->id},{rows=>1})->single;
426+
my $log = $logs->search({planet_id => $planet->id})->first;
427427
my %colony_data = (
428428
date_stamp => DateTime->now,
429429
planet_name => $planet->name,

bin/summarize_spies.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ sub summarize_spies {
142142
my $logs = $db->resultset('Lacuna::DB::Result::Log::Spies');
143143
while (my $spy = $spies->next) {
144144
out($spy->id.":".$spy->name);
145-
my $log = $logs->search({ spy_id => $spy->id },{ rows => 1 } )->single;
145+
my $log = $logs->search({ spy_id => $spy->id } )->first;
146146
my $offense_success_rate = ($spy->offense_mission_count) ? 100 * $spy->offense_mission_successes / $spy->offense_mission_count : 0;
147147
my $defense_success_rate = ($spy->defense_mission_count) ? 100 * $spy->defense_mission_successes / $spy->defense_mission_count : 0;
148148
my $success_rate = $offense_success_rate + $defense_success_rate;

bin/trelvestian/add_colonies.pl

+4-4
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@
3737
my @colonies;
3838

3939
if ($server_url =~ /us2/) {
40-
push @colonies, $viable->search({ x => { '>' => 150}, y => { '>' => 150} },{rows=>1})->single;
41-
push @colonies, $viable->search({ x => { '<' => -150}, y => { '>' => 150} },{rows=>1})->single;
42-
push @colonies, $viable->search({ x => { '<' => -150}, y => { '<' => -150} },{rows=>1})->single;
43-
push @colonies, $viable->search({ x => { '>' => 150}, y => { '<' => -150} },{rows=>1})->single;
40+
push @colonies, $viable->search({ x => { '>' => 150}, y => { '>' => 150} })->first;
41+
push @colonies, $viable->search({ x => { '<' => -150}, y => { '>' => 150} })->first;
42+
push @colonies, $viable->search({ x => { '<' => -150}, y => { '<' => -150} })->first;
43+
push @colonies, $viable->search({ x => { '>' => 150}, y => { '<' => -150} })->first;
4444
}
4545
elsif ($server_url =~ /us1/) {
4646
# four planets in 2|2

bin/util/move_plans_glyphs.pl

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
out('Loading DB');
3737
our $db = Lacuna->db;
3838

39-
my $body_from = $db->resultset('Map::Body')->search({id => $from})->single;
40-
my $body_dest = $db->resultset('Map::Body')->search({id => $to})->single;
39+
my $body_from = $db->resultset('Map::Body')->find($from);
40+
my $body_dest = $db->resultset('Map::Body')->find($to);
4141

4242
out(sprintf("%30s -> %30s", $body_from->name, $body_dest->name));
4343

bin/util/revamp_map.pl

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
my @habital_types = qw(P1 P2 P3 P4 P5 P6 P7 P8 P9 P10 P11 P12 P13 P14 P15 P16 P17 P18 P19 P20 P21 P22 P23 P24 P25 P26 P27 P28 P29 P30 P31 P32 P33 P34 P35 P36 P37 P38 P39 P40);
3333
my @gas_giant_types = qw(G1 G2 G3 G4 G5);
3434

35-
my $revamp_x = $db_config->search({name => 'revamp_x'})->single;
35+
my $revamp_x = $db_config->search({name => 'revamp_x'})->first;
3636
my $x_min = int($config->get('map_size/x')->[0]);
3737
my $x_max = int($config->get('map_size/x')->[1]);
3838

bin/util/seed_fissures.pl

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
while ($placed < $number) {
4848
my $target = Lacuna->db->resultset('Lacuna::DB::Result::Map::Body')->search(
4949
$search,
50-
{rows => 1, order_by => 'rand()' }
51-
)->single;
50+
{ order_by => 'rand()' }
51+
)->first;
5252
unless (defined $target) {
5353
print "No body found\n";
5454
$placed++;

bin/util/swap_bodies.pl

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
out('Loading DB');
3434
our $db = Lacuna->db;
3535

36-
my $body_from = $db->resultset('Map::Body')->search({id => $from})->single;
37-
my $body_dest = $db->resultset('Map::Body')->search({id => $to})->single;
36+
my $body_from = $db->resultset('Map::Body')->find($from);
37+
my $body_dest = $db->resultset('Map::Body')->find($to);
3838

3939
out(sprintf("%s at %d/%d -> %s at %d/%d",
4040
$body_from->name, $body_from->x, $body_from->y,

bin/weekly_medals.pl

+19-19
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ sub colonies {
4040
my $colonies = $db->resultset('Lacuna::DB::Result::Log::Colony');
4141

4242
# fastest growing
43-
my $colony = $colonies->search(undef, {order_by => [{ -desc => 'population_delta'},'rand()'], rows => 1})->single;
43+
my $colony = $colonies->search(undef, {order_by => [{ -desc => 'population_delta'},'rand()']})->first;
4444
add_medal($colony->empire_id,'fastest_growing_colony');
4545

4646
# largest
47-
$colony = $colonies->search(undef, {order_by => [{ -desc => 'population'},'rand()'], rows => 1})->single;
47+
$colony = $colonies->search(undef, {order_by => [{ -desc => 'population'},'rand()']})->first;
4848
add_medal($colony->empire_id,'largest_colony');
4949

5050
# reset deltas
@@ -57,35 +57,35 @@ sub empires {
5757
my $empires = $db->resultset('Lacuna::DB::Result::Log::Empire');
5858

5959
# best attacker in the game
60-
my $empire_log = $empires->search(undef, {order_by => [{ -desc => 'offense_success_rate'},'rand()'], rows => 1})->single;
60+
my $empire_log = $empires->search(undef, {order_by => [{ -desc => 'offense_success_rate'},'rand()']})->first;
6161
add_medal($empire_log->empire_id,'best_attacker_in_the_game');
6262

6363
# best attacker of the week
64-
$empire_log = $empires->search(undef, {order_by => [{ -desc => 'offense_success_rate_delta'},'rand()'], rows => 1})->single;
64+
$empire_log = $empires->search(undef, {order_by => [{ -desc => 'offense_success_rate_delta'},'rand()']})->first;
6565
add_medal($empire_log->empire_id, 'best_attacker_of_the_week');
6666

6767
# best defender in the game
68-
$empire_log = $empires->search(undef, {order_by => [{ -desc => 'defense_success_rate'},'rand()'], rows => 1})->single;
68+
$empire_log = $empires->search(undef, {order_by => [{ -desc => 'defense_success_rate'},'rand()']})->first;
6969
add_medal($empire_log->empire_id, 'best_defender_in_the_game');
7070

7171
# best defender of the week
72-
$empire_log = $empires->search(undef, {order_by => [{ -desc => 'defense_success_rate_delta'},'rand()'], rows => 1})->single;
72+
$empire_log = $empires->search(undef, {order_by => [{ -desc => 'defense_success_rate_delta'},'rand()']})->first;
7373
add_medal($empire_log->empire_id,'best_defender_of_the_week');
7474

7575
# dirtiest player in the game
76-
$empire_log = $empires->search(undef, {order_by => [{ -desc => 'dirtiest'},'rand()'], rows => 1})->single;
76+
$empire_log = $empires->search(undef, {order_by => [{ -desc => 'dirtiest'},'rand()']})->first;
7777
add_medal($empire_log->empire_id,'dirtiest_empire_in_the_game');
7878

7979
# dirtiest player of the week
80-
$empire_log = $empires->search(undef, {order_by => [{ -desc => 'dirtiest_delta'},'rand()'], rows => 1})->single;
80+
$empire_log = $empires->search(undef, {order_by => [{ -desc => 'dirtiest_delta'},'rand()']})->first;
8181
add_medal($empire_log->empire_id,'dirtiest_empire_of_the_week');
8282

8383
# fastest growing empire
84-
$empire_log = $empires->search(undef, {order_by => [{ -desc => 'empire_size_delta'},'rand()'], rows => 1})->single;
84+
$empire_log = $empires->search(undef, {order_by => [{ -desc => 'empire_size_delta'},'rand()']})->first;
8585
add_medal($empire_log->empire_id,'fastest_growing_empire');
8686

8787
# largest empire
88-
$empire_log = $empires->search(undef, {order_by => [{ -desc => 'empire_size'},'rand()'], rows => 1})->single;
88+
$empire_log = $empires->search(undef, {order_by => [{ -desc => 'empire_size'},'rand()']})->first;
8989
add_medal($empire_log->empire_id,'largest_empire');
9090

9191
# reset deltas
@@ -98,39 +98,39 @@ sub spies {
9898
my $spies = $db->resultset('Lacuna::DB::Result::Log::Spies');
9999

100100
# best in the game
101-
my $spy = $spies->search(undef,{order_by => [{ -desc => 'success_rate'}, 'rand()'], rows=>1})->single;
101+
my $spy = $spies->search(undef,{order_by => [{ -desc => 'success_rate'}, 'rand()']})->first;
102102
add_medal($spy->empire_id,'best_spy_in_the_game');
103103

104104
# best of the week
105-
$spy = $spies->search(undef,{order_by => [{ -desc => 'success_rate_delta'},'rand()'], rows=>1})->single;
105+
$spy = $spies->search(undef,{order_by => [{ -desc => 'success_rate_delta'},'rand()']})->first;
106106
add_medal($spy->empire_id,'best_spy_of_the_week');
107107

108108
# best offender in the game
109-
$spy = $spies->search(undef,{order_by => [{ -desc => 'offense_success_rate'},'rand()'], rows=>1})->single;
109+
$spy = $spies->search(undef,{order_by => [{ -desc => 'offense_success_rate'},'rand()']})->first;
110110
add_medal($spy->empire_id,'best_offensive_spy_in_the_game');
111111

112112
# best offender of the week
113-
$spy = $spies->search(undef,{order_by => [{ -desc => 'offense_success_rate_delta'},'rand()'], rows=>1})->single;
113+
$spy = $spies->search(undef,{order_by => [{ -desc => 'offense_success_rate_delta'},'rand()']})->first;
114114
add_medal($spy->empire_id,'best_offensive_spy_of_the_week');
115115

116116
# best defender in the game
117-
$spy = $spies->search(undef,{order_by => [{ -desc => 'defense_success_rate'},'rand()'], rows=>1})->single;
117+
$spy = $spies->search(undef,{order_by => [{ -desc => 'defense_success_rate'},'rand()']})->first;
118118
add_medal($spy->empire_id,'best_defensive_spy_in_the_game');
119119

120120
# best defender of the week
121-
$spy = $spies->search(undef,{order_by => [{ -desc => 'defense_success_rate_delta'},'rand()'], rows=>1})->single;
121+
$spy = $spies->search(undef,{order_by => [{ -desc => 'defense_success_rate_delta'},'rand()']})->first;
122122
add_medal($spy->empire_id,'best_defensive_spy_of_the_week');
123123

124124
# dirtiest in the game
125-
$spy = $spies->search(undef,{order_by => [{ -desc => 'dirtiest'},'rand()'], rows=>1})->single;
125+
$spy = $spies->search(undef,{order_by => [{ -desc => 'dirtiest'},'rand()']})->first;
126126
add_medal($spy->empire_id,'dirtiest_spy_in_the_game');
127127

128128
# dirtiest of the week
129-
$spy = $spies->search(undef,{order_by => [{ -desc => 'dirtiest_delta'},'rand()'], rows=>1})->single;
129+
$spy = $spies->search(undef,{order_by => [{ -desc => 'dirtiest_delta'},'rand()']})->first;
130130
add_medal($spy->empire_id,'dirtiest_spy_of_the_week');
131131

132132
# most improved of the week
133-
$spy = $spies->search(undef,{order_by => [{ -desc => 'level_delta'},'rand()'], rows=>1})->single;
133+
$spy = $spies->search(undef,{order_by => [{ -desc => 'level_delta'},'rand()']})->first;
134134
add_medal($spy->empire_id,'most_improved_spy_of_the_week');
135135

136136
# reset deltas

lib/Lacuna/AI.pm

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ has scratch => (
4040

4141
sub next_viable_colony {
4242
my $self = shift;
43-
return $self->viable_colonies->search(undef, { rows => 1, order_by => 'rand()' })->single;
43+
return $self->viable_colonies->search(undef, { order_by => 'rand()' })->first;
4444
}
4545

4646
sub create_empire {
@@ -57,8 +57,8 @@ sub create_empire {
5757
my $db = Lacuna->db;
5858
my $empire = $db->resultset('Lacuna::DB::Result::Empire')->new(\%attributes)->insert;
5959
# my $zone = $db->resultset('Lacuna::DB::Result::Map::Body')->get_column('zone')->max;
60-
# my $home = $self->viable_colonies->search({zone => $zone},{rows=>1})->single;
61-
my $home = $self->viable_colonies->search(undef,{rows=>1})->single;
60+
# my $home = $self->viable_colonies->search({zone => $zone})->first;
61+
my $home = $self->viable_colonies->search(undef,{ order_by => 'rand()'})->first;
6262
my @to_demolish = @{$home->building_cache};
6363
$home->delete_buildings(\@to_demolish);
6464
$empire->found($home);
@@ -560,7 +560,7 @@ sub start_attack {
560560
say ' Has one at star already...';
561561
$seconds = 1;
562562
}
563-
my $probe = $db->resultset('Lacuna::DB::Result::Ships')->search({body_id => $attacking_colony->id, type => 'probe', task=>'Docked'},{rows => 1})->single;
563+
my $probe = $db->resultset('Lacuna::DB::Result::Ships')->search({body_id => $attacking_colony->id, type => 'probe', task=>'Docked'})->first;
564564
if (defined $probe and $seconds == 0) {
565565
say ' Has a probe to launch for '.$target_colony->name.'...';
566566
$probe->send(target => $target_colony->star);

lib/Lacuna/DB/Result.pm

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ sub new {
2626

2727
sub random {
2828
my $self = shift;
29-
return $self->search( undef, { rows => 1, order_by => 'rand()' })->single;
29+
return $self->search( undef, { order_by => 'rand()' })->first;
3030
}
3131

3232

lib/Lacuna/DB/Result/Building/Archaeology.pm

+1-1
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ sub make_plan {
689689
my $glyph = Lacuna->db->resultset('Lacuna::DB::Result::Glyph')->search({
690690
type => $type,
691691
body_id => $self->body_id,
692-
})->single;
692+
})->first;
693693
unless (defined($glyph)) {
694694
confess [ 1002, "You don't have any glyphs of type $type."];
695695
}

0 commit comments

Comments
 (0)