Skip to content

Commit

Permalink
Allow other term name format
Browse files Browse the repository at this point in the history
  • Loading branch information
Jupiterrr committed Oct 21, 2015
1 parent 949ed2d commit 8cda2fc
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
12 changes: 12 additions & 0 deletions app/helpers/vvzs_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,19 @@ def sort_terms(terms)
private

def split_term(term)
if term.include?("/")
term = convert_term_name(term)
end
term.match(/(\w+) 20(.+)/).captures
end

def convert_term_name(name)
term = name[0..1]
if term == "SS"
name
else
"#{term} 20#{name[3..4]}"
end
end

end
1 change: 1 addition & 0 deletions app/models/room.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class Room < ActiveRecord::Base
has_many :event_dates
validates :name, :uuid, presence: true
validates :uuid, uniqueness: true
serialize :data, ActiveRecord::Coders::Hstore

before_create :try_to_find_poi

Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/vvz.rake
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ task :room_to_poi => :environment do |t, args|
rooms_without_poi.each do |room|
if result = selector.select(room.name)
room.poi = result.poi
room.data["poi.accuracy"] = result.accuracy
#room.data["poi.accuracy"] = result.accuracy
room.save!
end
end
Expand Down
16 changes: 12 additions & 4 deletions lib/vvz_updater/vvz_updater.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,19 @@ def update_events(term)
EventLinker.run!(term, events)
end

def exists?(term)
terms = KitApi::Client.new.get_terms.map(&:name)
terms.include?("SS 2015")
end
# def exists?(term)
# terms = KitApi::Client.new.get_terms.map(&:name)
# terms.include?("SS 2015")
# end

# def convert_term_name(name)
# term = name[0..1]
# if term == "SS"
# name
# else
# "#{term} 20#{name[3..4]}"
# end
# end

def improve_names(term_name)
puts "improving names"
Expand Down

0 comments on commit 8cda2fc

Please sign in to comment.