Changeset 9

Show
Ignore:
Timestamp:
02/07/07 23:17:57 (2 years ago)
Author:
simon
Message:

Add SQL and code for the counter (References #4), but no interface yet; adds SQL structure for ratings. (References #6)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Memories/Photo.pm

    r6 r9  
    66use Image::Seek; 
    77use constant PAGER_SYNTAX => "LimitXY"; 
    8 __PACKAGE__->columns(Essential => qw(id title uploader uploaded x y)); 
     8__PACKAGE__->columns(Essential => qw(id title uploader uploaded x y rating rated hit_count)); 
    99__PACKAGE__->untaint_columns(printable => [qw/title/]); 
    1010__PACKAGE__->columns(TEMP => qw/exif_object/); 
     
    3131        uploader => $r->user, 
    3232        uploaded => Time::Piece->new(), 
    33         title => $r->params->{title} 
     33        title => $r->params->{title}, 
     34        hit_count => 0, 
     35        rating => 0, 
     36        rated => 0, # Oh, the potential for divide by zero errors... 
    3437    }); 
    3538 
     
    7275sub view :Exported { 
    7376    my ($self, $r) = @_; 
     77    my $photo = $r->{objects}[0]; 
     78    $photo->hit_count($photo->hit_count()+1); 
    7479    if ($r->{session}{last_search}) { 
    75         my $photo = $r->{objects}[0]; 
    7680        # This is slightly inefficient 
    7781        my @search = split/,/, $r->{session}{last_search}; 
  • trunk/memories.sql

    r2 r9  
    55    uploaded datetime, 
    66    x integer, 
    7     y integer 
     7    y integer, 
     8    hit_count integer, 
     9    rating integer, 
     10    rated integer 
    811); 
    912