]> ruin.nu Git - ndwebbie.git/commitdiff
Add opening tick to raids
authorMichael Andreen <harv@ruin.nu>
Fri, 2 Apr 2021 11:23:57 +0000 (13:23 +0200)
committerMichael Andreen <harv@ruin.nu>
Fri, 2 Apr 2021 12:39:31 +0000 (14:39 +0200)
database/ndawn.sql
lib/NDWeb/Controller/Raids.pm
root/src/raids/edit.tt2
root/src/raids/index.tt2

index 1853e4fc014b2cb5449d05721d8c884a9f2aa834..f1301f0df0c7f73ebf30dc6f24a69881dc92f51d 100644 (file)
@@ -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,
index 998f3293386b4235526708777bba59d6afb6b665..f6b644a7b17465f80005d0bc5ed0765e889fd053 100644 (file)
@@ -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']);
 
index a835441c2d770599b455e8edc937099f9ef3e540..d2d5b5c38fac5fbfe7171160d5878bfa632f7c2e 100644 (file)
@@ -11,6 +11,7 @@
                        <p><a href="[% c.uri_for('remove',raid.id) %]">Remove raid</a></p>
                        <p>Landing tick: <input type="text" name="tick" value="[% raid.tick %]"></p>
                        <p>Number of waves: <input type="text" name="waves" value="[% raid.waves %]"></p>
+                       <p>Opening tick: <input type="text" name="open_tick" value="[% raid.open_tick %]"></p>
                [% IF removegroups.size > 0 %]
                        <p>The following groups has access to the raid</p>
                        <table>
index 7fbfba81c63b128b7af92587e4143c454e514f22..fcc5d1ce9528792af7e6058cbdf2be429cc1c8bb 100644 (file)
@@ -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 %]
        </p>