text: def definition():
      sql = """
  (
  	@assignments decimal(10,5),
  	@weeks decimal(10,5), 
  	@sessions decimal(10,5), 
  	@students decimal(10,5), 
  	@staffing_band decimal(10,5), 
  	@group_size decimal(10,5),
  	@assessments decimal(10,5)
  )
  RETURNS int
  AS_BREAK
  BEGIN
  	-- Declare the return variable here
  	DECLARE @hours decimal(10,5), @mins decimal(10,5); 
  	--Red green and yellow vars refer to the colours on Danny Cope's mod.coord. calculator excel file, 
  	--which this calculation is derived from, to make it easier to check and implement future changes 
  
  	DECLARE @base decimal(10,5), 
  			@red decimal(10,5), 
  			@green decimal(10,5),
  			@yellow decimal(10,5)
  
  	SELECT @group_size = ISNULL(NULLIF(@group_size,0),9999)
  	SELECT @weeks = ISNULL(NULLIF(@weeks,0),1)
  
  	-- Compute the four blocks
  	SELECT @base = ISNULL(@assignments,0)*0.5+ISNULL(@weeks,0)/10*(ISNULL(@sessions,1)+3)+1
  
  	SELECT @red = (CASE WHEN @students < 75 THEN FLOOR(@students/25) 
  						ELSE 3 END + 
  				   CASE WHEN @staffing_band = 1 THEN 1 
  						WHEN @staffing_band = 2 THEN 2 
  						ELSE 3 END) * ISNULL(@assignments,0)
  
  	SELECT @green = (CASE WHEN @group_size = 1 OR CEILING(@students/@group_size) = 1 THEN 0 
  						  WHEN CEILING(@students/@group_size) < 6 THEN 0.5 
  						  WHEN CEILING(@students/@group_size) < 11 THEN 1 
  						  ELSE 1.5 END + 
  					 CASE WHEN @staffing_band = 1 then 0.5 
  						  WHEN @staffing_band = 2 THEN 1 
  						  ELSE 1.5 END) * ISNULL(@assessments,0)
  
  	SELECT @yellow = CASE WHEN @students < 75 THEN FLOOR(@students/25) + 1 
  						  ELSE 4 END 
  	
  	SELECT @hours = @base + @red + @yellow + @green 
  	SELECT @mins = @hours*60/@weeks
  	-- Return the result of the function
  	RETURN @mins
  END
      """
      return sql
  