Show
Ignore:
Timestamp:
12/29/07 21:29:06 (2 years ago)
Author:
eevee
Message:

Locations mini-commit.
- Redid location pages to match the new format.
- Removed incorrect header text from Pokemon pages.
- Fixed up EncounterSet?->simplest_method to return more display-friendly data (thus merging together buckets with the same rarity), and corrected the old documentation. Also removed old inaccessible code.
- Refactored sections into their own database table.
- Refactored method-cell code into its own macro.

Location:
veekun/trunk/lib/Vee/Schema
Files:
1 added
3 modified

Legend:

Unmodified
Added
Removed
  • veekun/trunk/lib/Vee/Schema/LocationEncounters.pm

    r350 r393  
    1313__PACKAGE__->load_components('Core'); 
    1414__PACKAGE__->table('location_encounters'); 
    15 __PACKAGE__->add_columns(qw/ location_id rarity version section pokemon_id method min_level max_level /); 
    16 __PACKAGE__->set_primary_key(qw/ location_id rarity /); 
     15__PACKAGE__->add_columns(qw/ section_id rarity version pokemon_id method min_level max_level /); 
     16__PACKAGE__->set_primary_key(qw/ section_id rarity /); 
    1717 
    1818__PACKAGE__->belongs_to(pokemon => 'Vee::Schema::Pokemon', 'pokemon_id'); 
    19 __PACKAGE__->belongs_to(location => 'Vee::Schema::Locations', 'location_id'); 
     19__PACKAGE__->belongs_to(section => 'Vee::Schema::LocationSections', 'section_id'); 
    2020 
    2121=head1 METHODS 
     
    3030sub level { 
    3131    my ($self) = @_; 
    32      
     32 
    3333    my $level; 
    3434    my ($min, $max) = ($self->min_level, $self->max_level); 
  • veekun/trunk/lib/Vee/Schema/Locations.pm

    r350 r393  
    1616__PACKAGE__->set_primary_key('id'); 
    1717 
    18 __PACKAGE__->has_many(encounters => 'Vee::Schema::LocationEncounters', 'location_id'); 
     18__PACKAGE__->has_many(sections => 'Vee::Schema::LocationSections', 'location_id'); 
    1919 
    2020=head1 SEE ALSO 
  • veekun/trunk/lib/Vee/Schema/Pokemon.pm

    r389 r393  
    162162    my @encounter_sets; 
    163163 
    164     my $sections_rs = $self->encounters_rs( undef, { 
    165         group_by => 'location_id, section', 
     164    my $grouped_sections_rs = $self->encounters_rs( undef, { 
     165        group_by => 'section_id', 
    166166    } ); 
    167167 
    168     while (my $section = $sections_rs->next) { 
    169         my $encounters_rs = $section->location->encounters_rs( { 
     168    while (my $enc_section = $grouped_sections_rs->next) { 
     169        my $encounters_rs = $enc_section->section->encounters_rs( { 
    170170            version     => 'diamond', 
    171             section     => $section->section, 
     171            section_id  => $enc_section->section->id, 
    172172        } ); 
    173173