|  |  | @ -35,7 +35,7 @@ class Attachment < ApplicationRecord | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |   def title |  |  |  |   def title | 
			
		
	
		
		
			
				
					
					|  |  |  |     title = filename |  |  |  |     title = filename | 
			
		
	
		
		
			
				
					
					|  |  |  |     if container.is_a?(StudentWork) && author_id != User.current.id |  |  |  |     if container && container.is_a?(StudentWork) && author_id != User.current.id | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |       course = container&.homework_common&.course |  |  |  |       course = container&.homework_common&.course | 
			
		
	
		
		
			
				
					
					|  |  |  |       unless User.current.teacher_of_course?(course) |  |  |  |       unless User.current.teacher_of_course?(course) | 
			
		
	
		
		
			
				
					
					|  |  |  |         title = "#{Time.now.strftime('%Y%m%d%H%M%S')}_#{DCODES.sample(8).join}" + File.extname(filename) |  |  |  |         title = "#{Time.now.strftime('%Y%m%d%H%M%S')}_#{DCODES.sample(8).join}" + File.extname(filename) | 
			
		
	
	
		
		
			
				
					|  |  | 
 |