Beispiel #1
0
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)
Beispiel #2
0
django.setup()

from users.models import UserProfile
from projects.models import ManagerRegister
from django.contrib.auth.models import User
from reports.models import ProgressReport, DefectReport
from django.utils import timezone

print("test_started")

nxt_m_id = User.objects.count()+1
user = User.objects.create_user('M_'+str(nxt_m_id), 'les.com', 'ssword')
u = UserProfile(user=user, staff_id=nxt_m_id, role='m')
u.save()

project_id = ManagerRegister.create_project(u, "report Project")
project = ManagerRegister.get_project_by_id(u, project_id)
if ManagerRegister.start_project(u, project_id):
	print("The project is started")

print("The manager is called" + str(u.user.username))

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()
Beispiel #3
0
import os, django
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "PDT.settings")
django.setup()
from projects.models import ManagerRegister, DeveloperRegister
from users.models import UserProfile
from django.contrib.auth.models import User
import time

nxt_m_id = User.objects.count()+1
user = User.objects.create_user('M_'+str(nxt_m_id), '*****@*****.**', 'johnpassword')
u = UserProfile(user=user, staff_id=nxt_m_id, role='m')
u.save()

project_id = ManagerRegister.create_project(u, "Demo Project")
project = ManagerRegister.get_project_by_id(u, project_id)
if ManagerRegister.start_project(u, project_id):
	print("The project is started")
	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 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()
import os, django
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "PDT.settings")
django.setup()

from users.models import UserProfile
from projects.models import ManagerRegister
from django.contrib.auth.models import User
from django.utils import timezone

nxt_m_id = User.objects.count()+1
user = User.objects.create_user('M_'+str(nxt_m_id), '*****@*****.**', 'johnpassword')
u = UserProfile(user=user, staff_id=nxt_m_id, role='m')
u.save()

project_id = ManagerRegister.create_project(u, "Demo Project")
project = ManagerRegister.get_project_by_id(u, project_id)
if ManagerRegister.start_project(u, project_id):
	print("The project is started")

for i in range(5):
	## get next phase of the project
		## switch to the new phase
		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 phase 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):
					print("\tthe phase is switched to: "+str(project.get_current_phase().get_current_iteration()))
Beispiel #5
0
def assign_developer(request, p_id):
  manager = request.user.userprofile
  if ManagerRegister.assign_deverloper(manager, p_id, request.POST['staff_id']):
    return redirect(index_selected, p_id, 'panel1')
Beispiel #6
0
def switch_iteration(request, p_id, iter_num):
  manager = request.user.userprofile
  if ManagerRegister.switch_iteration(manager, p_id, iter_num):
    return redirect(index_selected, p_id, 'panel2')
  print("Fail")
Beispiel #7
0
def previous_phase(request, p_id):
  manager = request.user.userprofile
  if ManagerRegister.previous_phase(manager, p_id):
    return redirect(index_selected, p_id, 'panel1')
  print("Fail")
Beispiel #8
0
def stop(request, p_id):
  manager = request.user.userprofile
  ManagerRegister.stop_project(manager, p_id)
  return redirect(index_selected, p_id, 'panel1')
Beispiel #9
0
def create(request): 
  name = request.POST['name']
  manager = request.user.userprofile
  p_id = ManagerRegister.create_project(manager, name)
  return redirect(index_selected, p_id, 'panel1')
Beispiel #10
0
def set_yield_assumption(request,p_id):
  nyield = request.POST['new_yield']
  manager = request.user.userprofile
  if ManagerRegister.update_yield_assumption(manager, p_id, nyield):
    return redirect(index_selected, p_id, 'panel4')
Beispiel #11
0
def set_code_size(request, p_id, i_id):
  size = request.POST['code_size']
  manager = request.user.userprofile
  if ManagerRegister.update_progress_report(manager, i_id, size):
    return redirect(index_selected, p_id, 'panel3')