lib/CrashTest/Model/CrashReport.pm
author Vincent Tondellier <tonton+hg@team1664.org>
Mon, 28 Dec 2015 23:08:23 +0100
changeset 88 c82f5589db11
parent 83 eaf6d0ea4e65
child 91 10a62da240f4
permissions -rw-r--r--
Add first cut of the crash grouping feature
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
78
0ebef32c34af Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
     1
# This program is free software: you can redistribute it and/or modify
0ebef32c34af Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
     2
# it under the terms of the GNU General Public License as published by
0ebef32c34af Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
     3
# the Free Software Foundation, either version 3 of the License, or
0ebef32c34af Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
     4
# (at your option) any later version.
0ebef32c34af Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
     5
#
0ebef32c34af Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
     6
# This program is distributed in the hope that it will be useful,
0ebef32c34af Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
     7
# but WITHOUT ANY WARRANTY; without even the implied warranty of
0ebef32c34af Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
     8
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0ebef32c34af Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
     9
# GNU General Public License for more details.
0ebef32c34af Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    10
#
0ebef32c34af Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    11
# You should have received a copy of the GNU General Public License
0ebef32c34af Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    12
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
0ebef32c34af Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    13
0ebef32c34af Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    14
package CrashTest::Model::CrashReport;
0ebef32c34af Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    15
use Mojo::Base -base;
0ebef32c34af Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    16
0ebef32c34af Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    17
has [ qw/app config/ ];
0ebef32c34af Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    18
0ebef32c34af Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    19
sub index {
0ebef32c34af Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    20
    my ($self, $page, $nperpage, $search_str) = @_;
0ebef32c34af Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    21
83
eaf6d0ea4e65 Request a specific model to use in the storage helper
Vincent Tondellier <tonton+hg@team1664.org>
parents: 78
diff changeset
    22
    return $self->app->storage->first("CrashReport::index", $page, $nperpage, $search_str);
78
0ebef32c34af Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    23
}
0ebef32c34af Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    24
0ebef32c34af Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    25
sub create {
0ebef32c34af Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    26
    my ($self, $uuid, $pjson, $dump) = @_;
0ebef32c34af Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    27
83
eaf6d0ea4e65 Request a specific model to use in the storage helper
Vincent Tondellier <tonton+hg@team1664.org>
parents: 78
diff changeset
    28
    return $self->app->storage->each("CrashReport::create", $uuid, $pjson, $dump);
78
0ebef32c34af Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    29
}
0ebef32c34af Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    30
0ebef32c34af Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    31
sub get_processed_data {
0ebef32c34af Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    32
    my ($self, $uuid) = @_;
0ebef32c34af Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    33
83
eaf6d0ea4e65 Request a specific model to use in the storage helper
Vincent Tondellier <tonton+hg@team1664.org>
parents: 78
diff changeset
    34
    return $self->app->storage->first("CrashReport::get_processed_data", $uuid);
78
0ebef32c34af Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    35
}
0ebef32c34af Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    36
0ebef32c34af Refactor everything
Vincent Tondellier <tonton+hg@team1664.org>
parents:
diff changeset
    37
1;