impress/app/controllers/broken_image_reports_controller.rb
Matchu 696b2aedaf give SWFs real, unique ID numbers
Lots of scary bugs were being caused by the fact that the possibly-duplicate Neopets ID
was being treated as an SWF's real primary key, meaning that a save meant for object swf
number 123 could be saved to biology swf number 123. Which is awful.

This update gives SWFs their own unique internal ID numbers. All external lookups still use
the remote ID and the type, meaning that the client side remains totally unchanged (phew).
However, all database relationships with SWFs use the new ID numbers, making everything
cleaner. Yay.

There are probably a few places where it would be appropriate to optimize certain lookups
that still depend on remote ID and type. Whatever. Today's goal was to remove crazy
glitches that have been floating around like mad. And I think that goal has been met.
2012-01-12 17:17:59 -06:00

28 lines
878 B
Ruby

class BrokenImageReportsController < ApplicationController
def new
ids = params[:asset_ids]
assets = SwfAsset.arel_table
@swf_assets = SwfAsset.where(:has_image => true).where((
assets[:remote_id].in(ids[:biology]).and(assets[:type].eq('biology'))
).or(
assets[:remote_id].in(ids[:object]).and(assets[:type].eq('object'))
))
end
def create
swf_asset = SwfAsset.where(:type => params[:swf_asset_type]).
find_by_remote_id(params[:swf_asset_remote_id])
if swf_asset.report_broken
flash[:success] = "Thanks! This image will be reconverted soon. If it " +
"looks the same after conversion, please consider sending a bug report."
else
flash[:alert] = "This image is already in line for reconversion. We'll " +
"get to it soon, don't worry."
end
redirect_to :back
end
end