From 6afef880dc11d41441cbf1d87c358170fe9459f5 Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Thu, 24 Apr 2014 19:45:10 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9contest=E8=A1=A8=E4=B8=AD?= =?UTF-8?q?budget=E5=AD=97=E6=AE=B5=E7=9A=84=E5=B1=9E=E6=80=A7=EF=BC=8C?= =?UTF-8?q?=E5=B0=86integer=E6=94=B9=E4=B8=BAstring?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/contest.rb | 2 +- ...ge_created_at_of_contests_to_created_on.rb | 4 +- ...40424022002_remove_budget_from_contests.rb | 10 + db/schema.rb | 250 +++++++++++++++++- 4 files changed, 259 insertions(+), 7 deletions(-) create mode 100644 db/migrate/20140424022002_remove_budget_from_contests.rb diff --git a/app/models/contest.rb b/app/models/contest.rb index edc252574..58dcb2ea7 100644 --- a/app/models/contest.rb +++ b/app/models/contest.rb @@ -24,7 +24,7 @@ class Contest < ActiveRecord::Base validates_length_of :description, :maximum => DESCRIPTION_LENGTH_LIMIT validates_presence_of :author_id, :name, :deadline validates_format_of :deadline, :with => /^[\d]{4}[-][\d]{1,2}[-][\d]{1,2}$/ - validates_format_of :budget, :with => /^(\d+)$|^(\d+).([0-9]{2})|^(\d+).([0-9]{1})$/ + # validates_format_of :budget, :with => /^(\d+)$|^(\d+).([0-9]{2})|^(\d+).([0-9]{1})$/ validate :validate_user after_create :act_as_activity diff --git a/db/migrate/20140327082704_change_created_at_of_contests_to_created_on.rb b/db/migrate/20140327082704_change_created_at_of_contests_to_created_on.rb index 32d52d35a..07ac779c2 100644 --- a/db/migrate/20140327082704_change_created_at_of_contests_to_created_on.rb +++ b/db/migrate/20140327082704_change_created_at_of_contests_to_created_on.rb @@ -1,10 +1,10 @@ class ChangeCreatedAtOfContestsToCreatedOn < ActiveRecord::Migration - def self.up + def up rename_column :contests, :created_at, :created_on rename_column :contests, :updated_at, :updated_on end - def self.down + def down rename_column :contests, :created_on, :created_at rename_column :contests, :updated_on, :updated_at end diff --git a/db/migrate/20140424022002_remove_budget_from_contests.rb b/db/migrate/20140424022002_remove_budget_from_contests.rb new file mode 100644 index 000000000..8b19e428f --- /dev/null +++ b/db/migrate/20140424022002_remove_budget_from_contests.rb @@ -0,0 +1,10 @@ +class RemoveBudgetFromContests < ActiveRecord::Migration + def self.up + change_column :contests, :budget, :string, :default => "" + end + + def self.down + change_column :contests, :budget, :integer, :default => 0 + end + +end diff --git a/db/schema.rb b/db/schema.rb index 3918413f3..245460419 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20140421044830) do +ActiveRecord::Schema.define(:version => 20140424022002) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -23,6 +23,15 @@ ActiveRecord::Schema.define(:version => 20140421044830) do add_index "activities", ["user_id", "act_type"], :name => "index_activities_on_user_id_and_act_type" add_index "activities", ["user_id"], :name => "index_activities_on_user_id" + create_table "apply_project_masters", :force => true do |t| + t.integer "user_id" + t.string "apply_type" + t.integer "apply_id" + t.integer "status" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "attachments", :force => true do |t| t.integer "container_id" t.string "container_type", :limit => 30 @@ -62,6 +71,20 @@ ActiveRecord::Schema.define(:version => 20140421044830) do add_index "auth_sources", ["id", "type"], :name => "index_auth_sources_on_id_and_type" + create_table "bak_mentioned", :primary_key => "Id", :force => true do |t| + t.string "this_real_name", :limit => 1000 + t.integer "is_mentioned_in" + t.string "context", :limit => 2000 + end + + add_index "bak_mentioned", ["this_real_name", "is_mentioned_in"], :name => "name_mention", :length => {"this_real_name"=>900, "is_mentioned_in"=>nil} + add_index "bak_mentioned", ["this_real_name"], :name => "this_real_name" + add_index "bak_mentioned", ["this_real_name"], :name => "this_real_name_2" + add_index "bak_mentioned", ["this_real_name"], :name => "this_real_name_3", :length => {"this_real_name"=>900} + add_index "bak_mentioned", ["this_real_name"], :name => "this_real_name_4" + add_index "bak_mentioned", ["this_real_name"], :name => "this_real_name_5" + add_index "bak_mentioned", ["this_real_name"], :name => "this_real_name_6" + create_table "biding_projects", :force => true do |t| t.integer "project_id" t.integer "bid_id" @@ -101,6 +124,11 @@ ActiveRecord::Schema.define(:version => 20140421044830) do add_index "boards", ["last_message_id"], :name => "index_boards_on_last_message_id" add_index "boards", ["project_id"], :name => "boards_project_id" + create_table "categories", :primary_key => "Id", :force => true do |t| + t.integer "proj_id", :default => 0, :null => false + t.text "proj_categories" + end + create_table "changes", :force => true do |t| t.integer "changeset_id", :null => false t.string "action", :limit => 1, :default => "", :null => false @@ -179,14 +207,14 @@ ActiveRecord::Schema.define(:version => 20140421044830) do create_table "contests", :force => true do |t| t.string "name" - t.integer "budget" + t.string "budget", :default => "" t.integer "author_id" t.date "deadline" t.string "description" t.integer "commit" t.string "password" - t.datetime "created_on", :null => false - t.datetime "updated_on", :null => false + t.datetime "created_on", :null => false + t.datetime "updated_on", :null => false end create_table "courses", :force => true do |t| @@ -265,6 +293,14 @@ ActiveRecord::Schema.define(:version => 20140421044830) do add_index "documents", ["created_on"], :name => "index_documents_on_created_on" add_index "documents", ["project_id"], :name => "documents_project_id" + create_table "eco_projects", :force => true do |t| + t.integer "proj_id", :default => 0, :null => false + t.integer "eco_proj_id" + t.datetime "date_collected" + end + + add_index "eco_projects", ["proj_id"], :name => "proj_id" + create_table "enabled_modules", :force => true do |t| t.integer "project_id" t.string "name", :null => false @@ -286,6 +322,137 @@ ActiveRecord::Schema.define(:version => 20140421044830) do add_index "enumerations", ["id", "type"], :name => "index_enumerations_on_id_and_type" add_index "enumerations", ["project_id"], :name => "index_enumerations_on_project_id" + create_table "events", :primary_key => "event_id", :force => true do |t| + t.string "job_name" + t.datetime "event_time" + t.string "event_type", :limit => 20 + end + + create_table "fm_article", :force => true do |t| + t.integer "proj_id", :default => 0, :null => false + t.text "article_title", :limit => 16777215 + t.text "article_link", :limit => 16777215 + t.text "article_time", :limit => 16777215 + t.datetime "date_collected" + end + + add_index "fm_article", ["proj_id"], :name => "proj_id" + + create_table "fm_bugtracker_link", :force => true do |t| + t.integer "proj_id", :default => 0, :null => false + t.text "description", :limit => 16777215 + t.datetime "date_collected" + end + + add_index "fm_bugtracker_link", ["proj_id"], :name => "proj_id" + + create_table "fm_datametric_link", :force => true do |t| + t.integer "proj_id", :default => 0, :null => false + t.text "description", :limit => 16777215 + t.datetime "date_collected" + end + + add_index "fm_datametric_link", ["proj_id"], :name => "proj_id" + + create_table "fm_dependency_link", :force => true do |t| + t.integer "proj_id", :default => 0, :null => false + t.text "description", :limit => 16777215 + t.datetime "date_collected" + end + + add_index "fm_dependency_link", ["proj_id"], :name => "proj_id" + + create_table "fm_download_link", :force => true do |t| + t.integer "proj_id", :default => 0, :null => false + t.text "download_link", :limit => 16777215 + t.datetime "date_collected" + end + + add_index "fm_download_link", ["proj_id"], :name => "proj_id" + + create_table "fm_heartbeat", :force => true do |t| + t.integer "proj_id", :default => 0, :null => false + t.float "popularity_score", :limit => 12 + t.float "vitality_score", :limit => 12 + t.integer "subscription" + t.integer "voting_score" + t.integer "voting_count" + t.datetime "date_collected" + end + + add_index "fm_heartbeat", ["proj_id"], :name => "proj_id" + + create_table "fm_license", :force => true do |t| + t.integer "proj_id", :default => 0, :null => false + t.text "description", :limit => 16777215 + t.datetime "date_collected" + end + + add_index "fm_license", ["proj_id"], :name => "proj_id" + + create_table "fm_mailinglist_link", :force => true do |t| + t.integer "proj_id", :default => 0, :null => false + t.text "description", :limit => 16777215 + t.datetime "date_collected" + end + + add_index "fm_mailinglist_link", ["proj_id"], :name => "proj_id" + + create_table "fm_operating_system", :force => true do |t| + t.integer "proj_id", :default => 0, :null => false + t.text "description", :limit => 16777215 + t.datetime "date_collected" + end + + add_index "fm_operating_system", ["proj_id"], :name => "proj_id" + + create_table "fm_programming_language", :force => true do |t| + t.integer "proj_id", :default => 0, :null => false + t.text "description", :limit => 16777215 + t.datetime "date_collected" + end + + add_index "fm_programming_language", ["proj_id"], :name => "proj_id" + + create_table "fm_project_spotlight", :force => true do |t| + t.integer "proj_id", :default => 0, :null => false + t.text "description", :limit => 16777215 + t.text "project_name", :limit => 16777215 + t.text "project_spotlight_link", :limit => 16777215 + t.datetime "date_collected" + end + + add_index "fm_project_spotlight", ["proj_id"], :name => "proj_id" + + create_table "fm_release", :force => true do |t| + t.integer "proj_id", :default => 0, :null => false + t.text "description", :limit => 16777215 + t.text "release_version", :limit => 16777215 + t.text "release_time", :limit => 16777215 + t.text "release_tag", :limit => 16777215 + t.datetime "date_collected" + end + + add_index "fm_release", ["proj_id"], :name => "proj_id" + + create_table "fm_submit", :force => true do |t| + t.integer "proj_id", :default => 0, :null => false + t.text "submitter", :limit => 16777215 + t.text "submitter_link", :limit => 16777215 + t.text "submit_time", :limit => 16777215 + t.datetime "date_collected" + end + + add_index "fm_submit", ["proj_id"], :name => "proj_id" + + create_table "fm_summary", :force => true do |t| + t.integer "proj_id", :default => 0, :null => false + t.text "description", :limit => 16777215 + t.datetime "date_collected" + end + + add_index "fm_summary", ["proj_id"], :name => "proj_id" + create_table "forums", :force => true do |t| t.string "name", :null => false t.string "description", :default => "" @@ -518,6 +685,22 @@ ActiveRecord::Schema.define(:version => 20140421044830) do add_index "news", ["created_on"], :name => "index_news_on_created_on" add_index "news", ["project_id"], :name => "news_project_id" + create_table "no_uses", :force => true do |t| + t.integer "user_id", :null => false + t.string "no_use_type" + t.integer "no_use_id" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + + create_table "ohloh_tagged", :force => true do |t| + t.integer "proj_id", :default => 0, :null => false + t.string "description", :limit => 100, :null => false + t.datetime "date_collected" + end + + add_index "ohloh_tagged", ["proj_id"], :name => "proj_id" + create_table "open_id_authentication_associations", :force => true do |t| t.integer "issued" t.integer "lifetime" @@ -533,6 +716,19 @@ ActiveRecord::Schema.define(:version => 20140421044830) do t.string "salt", :null => false end + create_table "open_source_projects", :force => true do |t| + t.string "name" + t.text "description" + t.integer "commit_count", :default => 0 + t.integer "code_line", :default => 0 + t.integer "users_count", :default => 0 + t.date "last_commit_time" + t.string "url" + t.date "date_collected" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "praise_tread_caches", :force => true do |t| t.integer "object_id", :null => false t.string "object_type" @@ -612,6 +808,23 @@ ActiveRecord::Schema.define(:version => 20140421044830) do add_index "queries", ["project_id"], :name => "index_queries_on_project_id" add_index "queries", ["user_id"], :name => "index_queries_on_user_id" + create_table "relative_memos", :force => true do |t| + t.integer "osp_id", :null => false + t.integer "parent_id" + t.string "subject", :null => false + t.text "content", :null => false + t.integer "author_id" + t.integer "replies_count", :default => 0 + t.integer "last_reply_id" + t.boolean "lock", :default => false + t.boolean "sticky", :default => false + t.boolean "is_quote", :default => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "viewed_count_crawl", :default => 0 + t.integer "viewed_count_local", :default => 0 + end + create_table "repositories", :force => true do |t| t.integer "project_id", :default => 0, :null => false t.string "url", :default => "", :null => false @@ -764,6 +977,22 @@ ActiveRecord::Schema.define(:version => 20140421044830) do add_index "tokens", ["user_id"], :name => "index_tokens_on_user_id" add_index "tokens", ["value"], :name => "tokens_value", :unique => true + create_table "tprojects", :force => true do |t| + t.string "name", :limit => 1000, :default => "0" + t.text "description", :limit => 16777215 + t.string "commit_count", :limit => 100, :default => "0" + t.string "code_line", :limit => 100 + t.string "last_commit_time", :limit => 100 + t.string "url", :limit => 1000 + t.datetime "date_collected" + t.string "created_at", :limit => 100 + t.string "updated_at", :limit => 100 + t.integer "proj_id", :null => false + t.string "user_count", :limit => 100 + end + + add_index "tprojects", ["proj_id"], :name => "proj_id" + create_table "trackers", :force => true do |t| t.string "name", :limit => 30, :default => "", :null => false t.boolean "is_in_chlog", :default => false, :null => false @@ -813,6 +1042,19 @@ ActiveRecord::Schema.define(:version => 20140421044830) do add_index "user_preferences", ["user_id"], :name => "index_user_preferences_on_user_id" + create_table "user_scores", :force => true do |t| + t.integer "user_id", :null => false + t.integer "collaboration" + t.integer "influence" + t.integer "skill" + t.integer "active" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "level" + t.integer "file" + t.integer "issue" + end + create_table "user_statuses", :force => true do |t| t.integer "changesets_count" t.integer "watchers_count" From 9baa07b9a3f97b30049c50df637f9869ea39ed97 Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Thu, 24 Apr 2014 20:44:35 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=8F=82=E8=B5=9B?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E9=A1=B5=E9=9D=A2=E4=B8=AD=E4=B8=A4=E5=88=97?= =?UTF-8?q?=E7=9A=84=E6=98=BE=E7=A4=BA=EF=BC=8C=E4=B8=BB=E8=A6=81=E6=98=AF?= =?UTF-8?q?=E9=98=B2=E6=AD=A2=E5=BA=94=E7=94=A8=E4=B8=8B=E8=BD=BD=E5=92=8C?= =?UTF-8?q?=E5=BC=80=E5=8F=91=E4=BA=BA=E5=91=98=E5=AD=97=E6=95=B0=E5=A4=AA?= =?UTF-8?q?=E9=95=BF=E6=98=BE=E7=A4=BA=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=8C?= =?UTF-8?q?=E4=BD=BF=E5=85=B6=E5=8F=AF=E4=BB=A5=E8=87=AA=E5=8A=A8=E6=8D=A2?= =?UTF-8?q?=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/softapplications/show.html.erb | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/app/views/softapplications/show.html.erb b/app/views/softapplications/show.html.erb index b39ab6c61..32ab3474b 100644 --- a/app/views/softapplications/show.html.erb +++ b/app/views/softapplications/show.html.erb @@ -19,31 +19,32 @@ - - + <% contest = @softapplication.contests.first %> - + - + - - + From 9038f2758cd29c5be459dde959504f594ddbf08f Mon Sep 17 00:00:00 2001 From: wanglinchun Date: Fri, 25 Apr 2014 10:10:36 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E5=B0=86=E6=97=A7?= =?UTF-8?q?=E7=9A=84=E7=AB=9E=E8=B5=9B=E4=BF=A1=E6=81=AF=E5=92=8C=E5=8F=82?= =?UTF-8?q?=E4=B8=8E=E7=AB=9E=E8=B5=9B=E7=9A=84=E9=A1=B9=E7=9B=AE=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E8=BF=81=E7=A7=BB=E5=88=B0=E6=96=B0=E7=9A=84=E7=AB=9E?= =?UTF-8?q?=E8=B5=9B=E7=9B=B8=E5=85=B3=E6=95=B0=E6=8D=AE=E8=A1=A8=E5=90=8E?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E8=B0=83=E6=95=B4=E7=AB=9E=E8=B5=9B=E5=AD=90?= =?UTF-8?q?=E7=AB=99=E9=A6=96=E9=A1=B5=E6=9C=80=E6=96=B0=E7=83=AD=E9=97=A8?= =?UTF-8?q?=E7=AB=9E=E8=B5=9B=E7=9A=84=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/welcome_helper.rb | 16 ++++++++-------- app/views/welcome/contest.html.erb | 5 +++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index 9970ee9c6..e25b4f3f6 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -98,14 +98,14 @@ module WelcomeHelper end def find_all_hot_contest limit=10 - # Contest.reorder("created_on DESC").all.take limit - mix_bid = [] - mix_bid += Contest.reorder("created_on DESC").take(limit).to_a - mix_bid += Bid.visible.where('reward_type = ?', 2).reorder('bids.created_on desc').take(limit).to_a - mix_bid.sort do |older, newer| - newer.created_on - older.created_on - end - mix_bid.take limit + Contest.reorder("created_on DESC").all.take limit + # mix_bid = [] + # mix_bid += Contest.reorder("created_on DESC").take(limit).to_a + # mix_bid += Bid.visible.where('reward_type = ?', 2).reorder('bids.created_on desc').take(limit).to_a + # mix_bid.sort do |older, newer| + # newer.created_on - older.created_on + # end + # mix_bid.take limit end def find_all_hot_softapplication limit=10 diff --git a/app/views/welcome/contest.html.erb b/app/views/welcome/contest.html.erb index 6ef2b4796..d8dc45873 100644 --- a/app/views/welcome/contest.html.erb +++ b/app/views/welcome/contest.html.erb @@ -138,7 +138,7 @@ <%= link_to "更多>>", {:controller => 'contests', :action => 'index', :host => Setting.contest_domain}, :target => "_blank" %>
- <% find_all_hot_contest.map do |contest| break if(contest == find_all_hot_contest[6]) %> + <% find_all_hot_contest.map do |contest| break if(contest == find_all_hot_contest[5]) %>
  • @@ -146,7 +146,8 @@
    - <%= link_to(contest.name, contest.event_url, :class => "d-g-blue d-p-project-name", :title => "#{contest.name}", :target => "_blank") %> + + <%= link_to(contest.name, show_contest_contest_path(contest.id), :class => "d-g-blue d-p-project-name", :title => "#{contest.name}", :target => "_blank") %>
  • <%= @softapplication.name %> + <%= link_to '删除', softapplication_path(@softapplication), method: :delete, data: { confirm: '您确定要删除吗?' } if @softapplication.destroyable_by? User.current %>  <%= link_to '编辑', edit_softapplication_path(@softapplication), method: :get if @softapplication.destroyable_by? User.current %>
    所属类别:<%= @softapplication.app_type_name %>所属类别:<%= @softapplication.app_type_name %>所属竞赛:<%= contest ? link_to(contest.name, show_contest_contest_path(contest)) : '尚未加入竞赛'%>所属竞赛:<%= contest ? link_to(contest.name, show_contest_contest_path(contest)) : '尚未加入竞赛'%>
    发布人员:<%= @softapplication.user.name %>发布人员:<%= @softapplication.user.name %> 系统支持:<%= @softapplication.android_min_version_available %>
    + 应用下载: - <% options = {:author => true, :deletable => @softapplication.user.eql?(User.current) } %> - <%= render :partial => 'attachments/app_link', :locals => {:attachments => @app_items, :options => options} %> + + <% options = {:author => true, :deletable => @softapplication.user.eql?(User.current) } %><%= render :partial => 'attachments/app_link', :locals => {:attachments => @app_items, :options => options} %> + 开发人员:<%= @softapplication.application_developers %>
    平均评分: <%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %>平均评分: <%= rating_for @softapplication, :static => true, dimension: :quality, class: 'rateable div_inline' %> 发布时间:<%=format_time @softapplication.created_at %>