From: Michael Andreen Date: Fri, 2 Apr 2021 11:23:57 +0000 (+0200) Subject: Add opening tick to raids X-Git-Url: https://ruin.nu/git/?p=ndwebbie.git;a=commitdiff_plain;h=7510a73591d06ced24af063d598029fd9d1bce8a Add opening tick to raids --- diff --git a/database/ndawn.sql b/database/ndawn.sql index 1853e4f..f1301f0 100644 --- a/database/ndawn.sql +++ b/database/ndawn.sql @@ -2142,6 +2142,7 @@ CREATE TABLE raids ( tick integer NOT NULL, open boolean DEFAULT false NOT NULL, waves integer DEFAULT 3 NOT NULL, + open_tick integer, message text NOT NULL, removed boolean DEFAULT false NOT NULL, released_coords boolean DEFAULT false NOT NULL, diff --git a/lib/NDWeb/Controller/Raids.pm b/lib/NDWeb/Controller/Raids.pm index 998f329..f6b644a 100644 --- a/lib/NDWeb/Controller/Raids.pm +++ b/lib/NDWeb/Controller/Raids.pm @@ -54,7 +54,7 @@ sub index :Path :Args(0) { if ($c->check_user_roles(qw/raids_info/)){ my $query = $dbh->prepare(q{ - SELECT r.id,open ,tick + SELECT r.id,open ,tick, open_tick, released_coords AS releasedcoords ,waves*COUNT(DISTINCT rt.id) AS waves,COUNT(rc.uid) AS claims ,COUNT(nullif(rc.launched,false)) AS launched ,COUNT(NULLIF(uid > 0 OR rc.wave > r.waves,true)) AS blocked @@ -215,7 +215,7 @@ sub edit : Local { my ($self, $c, $raid, $order) = @_; my $dbh = $c->model; - my $query = $dbh->prepare(q{SELECT id,tick,waves,message,released_coords,open,ftid + my $query = $dbh->prepare(q{SELECT id,tick,waves,message,released_coords,open,ftid,open_tick FROM raids WHERE id = ? }); $raid = $dbh->selectrow_hashref($query,undef,$raid); @@ -313,9 +313,10 @@ sub postraidupdate : Local { $dbh->begin_work; my $tick = $c->req->param('tick'); my $waves = $c->req->param('waves'); - $dbh->do(q{UPDATE raids SET message = ?, tick = ?, waves = ? WHERE id = ?} + my $open_tick = $c->req->param('open_tick') || undef; + $dbh->do(q{UPDATE raids SET message = ?, tick = ?, waves = ?, open_tick = ? WHERE id = ?} ,undef,html_escape $c->req->param('message') - ,$tick,$waves,$raid); + ,$tick,$waves,$open_tick,$raid); $c->forward('log',[$raid, 'BC updated raid']); diff --git a/root/src/raids/edit.tt2 b/root/src/raids/edit.tt2 index a835441..d2d5b5c 100644 --- a/root/src/raids/edit.tt2 +++ b/root/src/raids/edit.tt2 @@ -11,6 +11,7 @@

Remove raid

Landing tick:

Number of waves:

+

Opening tick:

[% IF removegroups.size > 0 %]

The following groups has access to the raid

diff --git a/root/src/raids/index.tt2 b/root/src/raids/index.tt2 index 7fbfba8..fcc5d1c 100644 --- a/root/src/raids/index.tt2 +++ b/root/src/raids/index.tt2 @@ -38,6 +38,9 @@ [% END %] Landing tick: [% r.tick %] Waves: [% r.waves %] + [% IF r.open_tick %] + Opening tick: [% r.open_tick %] + [% END %] Claims: [% r.claims %] Launched: [% r.launched %]