<commit_before>class ProjectsController < BaseController
	before_filter :get_user_projects

	def index
		@tasks = @current_user.tasks.includes(:activity => :project)

		respond_to do |format|
			format.html
			format.json { render json: @projects.to_json(:include => {:activities => {:include => :tasks}}) }
		end
	end

	def show
		@project = @current_user.projects.includes(:activities => :tasks).find(params[:id])

		respond_to do |format|
			format.html
			format.json { render json: @project.to_json(:include => {:activities => {:include => :tasks}}) }
		end
	end

	def new
		@project = Project.new
	end

	def create
		@project = Project.new(project_params)
 		respond_to do |format|
 			format.html {
 			if @project.save
 				@project.manager = @current_user
		    redirect_to projects_path
		  else
		      redirect_to new_project_path
		    end
 			}
 			format.json {
 				if @project.save
 					@project.manager = @current_user
		      render json: { :message => 'Successful'} 
		    else
		      render json: { :message => 'Unsuccessful'}, :status => :unauthorized
		    end	
 			}
 		end
	end

	private
	def get_user_projects
		@myprojects = @current_user.projects_by_role(Role.manager)
		@assignedprojects = @current_user.projects_by_role(Role.member)
		@archievedprojects = @current_user.archieved_projects
	end
	def project_params
		params[:project][:finished] = false
		params.require(:project).permit(:name, 
			:short_description, 
			:long_description, 
			:start_date, 
			:end_date,
			:duration,
			:member_count,
			:budget,
			:finished)
	end
end<commit_msg>Getting json of all projects resolved.<commit_after>class ProjectsController < BaseController
	before_filter :get_user_projects

	def index
		@tasks = @current_user.tasks.includes(:activity => :project)

		respond_to do |format|
			format.html
			format.json { render json: { :myprojects => @myprojects.includes(:activities => :tasks), 
			:assignedprojects => @assignedprojects.includes(:activities => :tasks), 
			:archievedprojects => @archievedprojects.includes(:activities => :tasks) } }
		end
	end

	def show
		@project = @current_user.projects.includes(:activities => :tasks).find(params[:id])

		respond_to do |format|
			format.html
			format.json { render json: @project.to_json(:include => {:activities => {:include => :tasks}}) }
		end
	end

	def new
		@project = Project.new
	end

	def create
		@project = Project.new(project_params)
 		respond_to do |format|
 			format.html {
 			if @project.save
 				@project.manager = @current_user
		    redirect_to projects_path
		  else
		      redirect_to new_project_path
		    end
 			}
 			format.json {
 				if @project.save
 					@project.manager = @current_user
		      render json: { :message => 'Successful'} 
		    else
		      render json: { :message => 'Unsuccessful'}, :status => :unauthorized
		    end	
 			}
 		end
	end

	private
	def get_user_projects
		@myprojects = @current_user.projects_by_role(Role.manager)
		@assignedprojects = @current_user.projects_by_role(Role.member)
		@archievedprojects = @current_user.archieved_projects
	end

	def project_params
		params[:project][:finished] = false
		params.require(:project).permit(:name, 
			:short_description, 
			:long_description, 
			:start_date, 
			:end_date,
			:duration,
			:member_count,
			:budget,
			:finished)
	end
end
{'fraction_non_alphanumeric': 0.11443978430197724, 'fraction_numerical': 0.0, 'mean_word_length': 3.611878453038674, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3296783', 'n_tokens_mistral': 1259, 'n_tokens_neox': 1084, 'n_words': 225}