示例#1
0
文件: views.py 项目: kingychiu/akkok
def index_selected(request, selected, tab):
  user_profile = request.user.userprofile
  # Manager Mode
  if user_profile.role == 'm':
    context = ManagerRegister.gen_context(user_profile, selected, tab)
    return render(request, 'projects/index_manager.html', context)
  
  # Developer Mode
  if user_profile.role == 'd':
    context = DeveloperRegister.gen_context(user_profile, selected, tab)
    return render(request, 'projects/index_developer.html', context)
示例#2
0
		print("the phase is switched to: "+ str(project.get_current_phase()))
		phase = project.get_current_phase()
		if ManagerRegister.next_iteration(u, project_id):
			print("\tthe phase is switched to: "+str(project.get_current_phase().get_current_iteration()))
			print("\tcurrent active iteration: " + str(len(project.get_current_phase().iteration_set.filter(active=True))))

nxt_d_id = User.objects.count()+1
user = User.objects.create_user('D_'+str(nxt_d_id), '*****@*****.**', 'johnpassword')
d = UserProfile(user=user,staff_id=nxt_d_id, role='d')
d.save()

## assign
print("assign 1 Developer for project")
ManagerRegister.assign_deverloper(u, project_id, nxt_d_id)
print("Developer start work")
DeveloperRegister.start_work(d, project_id)
time.sleep(2)
print("Developer pause work, time:")
DeveloperRegister.pause_work(d, project_id)
print("Developer start work")
DeveloperRegister.start_work(d, project_id)
time.sleep(2)
print("Developer pause work, time:")
DeveloperRegister.pause_work(d, project_id)

nxt_d_id = User.objects.count()+1
user = User.objects.create_user('D_'+str(nxt_d_id), '*****@*****.**', 'johnpassword')
d = UserProfile(user=user,staff_id=nxt_d_id, role='d')
d.save()

## assign
示例#3
0
for i in range(4):
	## get next phase of the project
		## create progress report
		if ManagerRegister.next_phase(u, project_id):
			project = ManagerRegister.get_project_by_id(u, project_id)
			print("current active phase: " + str(len(project.phase_set.filter(active=True))))
			print("the project is switched to: "+str(project.get_current_phase()))
			for j in range(3):
				phase = project.get_current_phase()
				nxt_t = phase.next_iteration()
				if ManagerRegister.next_iteration(u, project_id):
					iteration = project.get_current_phase().iteration_set.filter(active=True)
					print("\tthe phase is switched to: "+str(project.get_current_phase().get_current_iteration()))
					print("\tcurrent active iteration: " + str(iteration[0].id))
					P_Report = ProgressReport(num_developer=2 , code_size = 1000*i, iteration=iteration[0])
					P_Report.save()
					print(P_Report.iteration.id)
					print("\tProgress Report of " +  str(iteration) + "is created:")
					print("\t\tDevelopers:" + str(P_Report.num_developer))
					print("\t\tCode Size:"  + str(P_Report.code_size))
					D_Report = DeveloperRegister.set_injected_by_iteration_id(d, iteration[0].id ,2*i)
					#D_Report = DefectReport(num_developer=1 , defect_injected = 10*i, defect_removed = 5*i, iteration=iteration[0])
					D_Report.save()
					print("\tDefect Report is created")
			data = ManagerRegister.show_phase_report(u,phase.id)
			print("<Phase Report>")
			print("\tInjected:" + str(data[0]))
			print("\tRemoved:" + str(data[1]))
			print("\tSize:" + str(data[2]))
			print("---------Next Phase---------")
示例#4
0
文件: views.py 项目: kingychiu/akkok
def set_defect_removed(request, p_id, i_id):
  defect = request.POST['defect']
  developer = request.user.userprofile
  if DeveloperRegister.set_removed_by_iteration_id(developer, i_id, defect):
    return redirect(index_selected, p_id, 'panel2')
示例#5
0
文件: views.py 项目: kingychiu/akkok
def set_timer(request, p_id, t_id):
  developer = request.user.userprofile
  if DeveloperRegister.set_timer(developer, t_id, request.POST['time']):
    return redirect(index_selected, p_id, 'panel3')
示例#6
0
文件: views.py 项目: kingychiu/akkok
def pause_timer(request, p_id):
  developer = request.user.userprofile
  if DeveloperRegister.pause_work(developer, p_id):
    return redirect(index_selected, p_id, 'panel1')