]>
Commit | Line | Data |
---|---|---|
1 | use utf8; | |
2 | package Gruntmaster::Data::Result::ProblemStatus; | |
3 | ||
4 | # Created by DBIx::Class::Schema::Loader | |
5 | # DO NOT MODIFY THE FIRST PART OF THIS FILE | |
6 | ||
7 | =head1 NAME | |
8 | ||
9 | Gruntmaster::Data::Result::ProblemStatus - List of (problem, user, result) | |
10 | ||
11 | =cut | |
12 | ||
13 | use strict; | |
14 | use warnings; | |
15 | ||
16 | use base 'DBIx::Class::Core'; | |
17 | ||
18 | =head1 TABLE: C<problem_status> | |
19 | ||
20 | =cut | |
21 | ||
22 | __PACKAGE__->table("problem_status"); | |
23 | ||
24 | =head1 ACCESSORS | |
25 | ||
26 | =head2 problem | |
27 | ||
28 | data_type: 'text' | |
29 | is_foreign_key: 1 | |
30 | is_nullable: 0 | |
31 | ||
32 | =head2 owner | |
33 | ||
34 | data_type: 'text' | |
35 | is_foreign_key: 1 | |
36 | is_nullable: 0 | |
37 | ||
38 | =head2 job | |
39 | ||
40 | data_type: 'integer' | |
41 | is_auto_increment: 1 | |
42 | is_foreign_key: 1 | |
43 | is_nullable: 0 | |
44 | sequence: 'problem_status_job_seq' | |
45 | ||
46 | =head2 solved | |
47 | ||
48 | data_type: 'boolean' | |
49 | default_value: false | |
50 | is_nullable: 0 | |
51 | ||
52 | True if the result is Accepted, False otherwise | |
53 | ||
54 | =cut | |
55 | ||
56 | __PACKAGE__->add_columns( | |
57 | "problem", | |
58 | { data_type => "text", is_foreign_key => 1, is_nullable => 0 }, | |
59 | "owner", | |
60 | { data_type => "text", is_foreign_key => 1, is_nullable => 0 }, | |
61 | "job", | |
62 | { | |
63 | data_type => "integer", | |
64 | is_auto_increment => 1, | |
65 | is_foreign_key => 1, | |
66 | is_nullable => 0, | |
67 | sequence => "problem_status_job_seq", | |
68 | }, | |
69 | "solved", | |
70 | { data_type => "boolean", default_value => \"false", is_nullable => 0 }, | |
71 | ); | |
72 | ||
73 | =head1 PRIMARY KEY | |
74 | ||
75 | =over 4 | |
76 | ||
77 | =item * L</owner> | |
78 | ||
79 | =item * L</problem> | |
80 | ||
81 | =back | |
82 | ||
83 | =cut | |
84 | ||
85 | __PACKAGE__->set_primary_key("owner", "problem"); | |
86 | ||
87 | =head1 RELATIONS | |
88 | ||
89 | =head2 job | |
90 | ||
91 | Type: belongs_to | |
92 | ||
93 | Related object: L<Gruntmaster::Data::Result::Job> | |
94 | ||
95 | =cut | |
96 | ||
97 | __PACKAGE__->belongs_to( | |
98 | "job", | |
99 | "Gruntmaster::Data::Result::Job", | |
100 | { id => "job" }, | |
101 | { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" }, | |
102 | ); | |
103 | ||
104 | =head2 owner | |
105 | ||
106 | Type: belongs_to | |
107 | ||
108 | Related object: L<Gruntmaster::Data::Result::User> | |
109 | ||
110 | =cut | |
111 | ||
112 | __PACKAGE__->belongs_to( | |
113 | "owner", | |
114 | "Gruntmaster::Data::Result::User", | |
115 | { id => "owner" }, | |
116 | { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" }, | |
117 | ); | |
118 | ||
119 | =head2 problem | |
120 | ||
121 | Type: belongs_to | |
122 | ||
123 | Related object: L<Gruntmaster::Data::Result::Problem> | |
124 | ||
125 | =cut | |
126 | ||
127 | __PACKAGE__->belongs_to( | |
128 | "problem", | |
129 | "Gruntmaster::Data::Result::Problem", | |
130 | { id => "problem" }, | |
131 | { is_deferrable => 0, on_delete => "CASCADE", on_update => "NO ACTION" }, | |
132 | ); | |
133 | ||
134 | ||
135 | # Created by DBIx::Class::Schema::Loader v0.07042 @ 2014-12-19 16:44:22 | |
136 | # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1OCTO6sM27DamVhQi3dWKg | |
137 | ||
138 | use Class::Method::Modifiers qw/after/; | |
139 | ||
140 | sub rawowner { shift->get_column('owner') } | |
141 | ||
142 | after qw/insert update delete/ => sub { | |
143 | my ($self) = @_; | |
144 | Gruntmaster::Data::purge '/us/'; | |
145 | Gruntmaster::Data::purge '/us/' . $self->rawowner; | |
146 | }; | |
147 | ||
148 | 1; |