sync_pkg_svr.destroy
end
+ # remove project
+ projects = Project.find(:all, :conditions => ["distribution_id = ?", dist.id])
+ projects.each do |project|
+ err = AdminProjectController.remove_project(project.id)
+ if err then
+ render :json => { :error => err}, :status => 406
+ return
+ end
+ end
+
+ # remove job info
+ jobs = Job.find(:all, :conditions => ["distribution_id = ?", dist.id])
+
+ if not jobs.nil? then
+ # remove job_timestamps table
+ jobs.each do |job|
+ jobTimestamp = JobTimestamp.delete_all(["job_id=?", job.id])
+ job.destroy
+ end
+
+ end
+
# remove distribution
dist.destroy
end
project_id = change_item[:ProjectId]
+ err = remove_project(project_id)
+ if err then
+ render :json => { :error => err}, :status => 406
+ else
+ render :json => { :success => "OK!" }
+ end
+ end
+
+ def AdminProjectController.remove_project(project_id)
project = Project.find(:first, :conditions => ["id = ?", project_id])
if project.nil?
errmsg = "project does not exist: #{project_id}"
- render :json => { :error => errmsg }, :status => 406
- return
+ return errmsg
end
# remove job info
# remove project
project.destroy
- render :json => { :success => "OK!" }
- end
+ return
+ end
def modifyProject
change_group_list = params[:ChangeInfoList]