Skip to content

Commit

Permalink
Fixed error with mkdir...
Browse files Browse the repository at this point in the history
using mkdir_p instead of mkdir to make sure directories are created
Updated template image to be higher resolution
Changed text generated for templates to flow better
  • Loading branch information
James-Tobin authored and rbclark committed Jun 29, 2017
1 parent b068d25 commit e1c6eb3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/models/team.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ def generate_certificate(user, directory, rank, total) # generate cert for speci
def generate_certificate_body(doc, username, rank, total) # generates the body of the certificate
doc.bounding_box([55, 200], width: 640, height: 200) do
doc.font('Helvetica', size: 18, style: :bold) do
doc.text "This is to certify that #{username}", color: '005BA1', align: :center, leading: 8
doc.text "successfully competed as a member of Team #{team_name},
doc.text "This is to certify that #{username}
successfully competed as a member of Team #{team_name},
achieving #{score} points and finishing #{rank} out of #{total} teams.", color: '005BA1', align: :center
end
end
Expand All @@ -177,14 +177,14 @@ def make_completion_cert_directories # creates division and team directories unl

def make_division_directory # creates division directory for storing completion certificates if it does not exist
certs_directory = Rails.root.join 'tmp', self.class.transform(division.name) + '-certificates'
Dir.mkdir(certs_directory) unless Dir.exist?(certs_directory)
Dir.mkdir_p(certs_directory) unless Dir.exist?(certs_directory)
certs_directory
end

# creates team directory for storing completion certificates if it does not exist
def make_team_directory(certs_directory)
team_cert_directory = certs_directory.join self.class.transform team_name
Dir.mkdir(team_cert_directory) unless Dir.exist?(team_cert_directory)
Dir.mkdir_p(team_cert_directory) unless Dir.exist?(team_cert_directory)
team_cert_directory
end

Expand Down
Binary file modified templates/ctf-certificate-template.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e1c6eb3

Please sign in to comment.