module DiscourseNarrativeBot
class CertificateGenerator
def initialize(user, date)
@user = user
@date = I18n.l(Date.parse(date), format: :date_only)
@discobot_user = User.find(-2)
end
def new_user_track
width = 538.583 # Default width for the SVG
svg = <<~SVG
SVG
end
def advanced_user_track
width = 722.8 # Default width for the SVG
<<~SVG
SVG
end
private
def name
(@user.name && !@user.name.blank? ? @user.name : @user.username).titleize
end
def logo_group(size, width, height)
begin
uri = URI(SiteSetting.logo_small_url)
logo_uri =
if uri.host.blank? || uri.scheme.blank?
URI("#{Discourse.base_url}/#{uri.path}")
else
uri
end
<<~URL
URL
rescue URI::InvalidURIError
''
end
end
def avatar_url
UrlHelper.absolute(Discourse.base_uri + @user.avatar_template.gsub('{size}', '250'))
end
end
end