|
|
@ -13,25 +13,25 @@ class StudentShort < Person
|
|
|
|
id: student.id,
|
|
|
|
id: student.id,
|
|
|
|
git: student.git,
|
|
|
|
git: student.git,
|
|
|
|
surname_initials: student.surname_and_initials,
|
|
|
|
surname_initials: student.surname_and_initials,
|
|
|
|
contact: student.contact_info
|
|
|
|
contact: student.contact
|
|
|
|
)
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def self.from_string(id, info_string)
|
|
|
|
def self.from_string(id, info_string)
|
|
|
|
parts = info_string.split(',').map(&:strip)
|
|
|
|
parts = info_string.split(',').map(&:strip)
|
|
|
|
raise ArgumentError, 'Invalid info string format' if parts.size < 3
|
|
|
|
raise ArgumentError, 'Invalid info string format' if parts.size < 3
|
|
|
|
|
|
|
|
|
|
|
|
surname_initials = parts[0]
|
|
|
|
surname_initials = parts[0]
|
|
|
|
git = parts[1].split(': ').last.strip
|
|
|
|
git = parts[1].split(': ').last.strip
|
|
|
|
contact_string = parts[2].split(': ', 2).last.strip
|
|
|
|
contact_string = parts[2].split(': ', 2).last.strip
|
|
|
|
|
|
|
|
|
|
|
|
contact = Contact.new_from_info(contact_string)
|
|
|
|
contact = Contact.new_from_info(contact_string)
|
|
|
|
|
|
|
|
|
|
|
|
new(
|
|
|
|
new(
|
|
|
|
id: id,
|
|
|
|
id: id,
|
|
|
|
git: git,
|
|
|
|
git: git,
|
|
|
|
surname_initials: surname_initials,
|
|
|
|
surname_initials: surname_initials,
|
|
|
|
contact: contact.info
|
|
|
|
contact: contact
|
|
|
|
)
|
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|