def get(self, *args, **kargs): # if check_permission(self): projectKey = self.session['current_project'] currentUser = self.auth.get_user_by_session() currentUser = self.user_model.get_by_id(currentUser['user_id']).key project_member = project.ProjectMembers().get_by_project_user( projectKey, currentUser) tasks = task.Task().get_by_project_user(projectKey, project_member[0]) open_count = 0 inprogress_count = 0 completed_count = 0 for i in tasks: if i.task_status == 'Open': open_count = open_count + 1 if i.task_status == 'In Progress': inprogress_count = inprogress_count + 1 if i.task_status == 'Done': completed_count = completed_count + 1 self.render_template( "user_new/test.html", { "tasks": tasks, "open_count": open_count, "inprogress_count": inprogress_count, "completed_count": completed_count })
def instantiate_from(self, filename): datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or \ os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'fhir-parser', 'downloads')) with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle: js = json.load(handle) self.assertEqual("Task", js["resourceType"]) return task.Task(js)
def testTask2(self): inst = self.instantiate_from("task-example-fm-poll.json") self.assertIsNotNone(inst, "Must have instantiated a Task instance") self.implTask2(inst) js = inst.as_json() self.assertEqual("Task", js["resourceType"]) inst2 = task.Task(js) self.implTask2(inst2)
def load_log(): loaded_list = [] if not os.path.exists("work_log.csv"): open('work_log.csv', "w").close() with open('work_log.csv', newline='') as file: reader = csv.reader(file, delimiter=',') rows = list(reader) for row in rows[1:]: loaded_list.append( task.Task(name=row[0], time=row[1], date=row[2], notes=row[3])) return loaded_list
def get(self, *args, **kargs): projectKey = self.session['current_project'] currentUser = self.auth.get_user_by_session() currentUser = self.user_model.get_by_id(currentUser['user_id']).key project_member = project.ProjectMembers().get_by_project_user( projectKey, currentUser) logging.info(projectKey) logging.info(project_member) tasks = task.Task().get_by_project_user(projectKey, currentUser) logging.info('da.das.dasd') logging.info(tasks) self.render_template("user_new/my_tasks.html", {"tasks": tasks})
def add_entry(): '''Add an Entry''' name = input('\nName\n>>> ') time = input('Time Taken (min)\n>>> ') notes = input('Notes\n>>> ') try: task_list.append( task.Task(name=name, time=time, notes=notes, date=datetime.datetime.now().strftime('%m/%d/%Y'))) except ValueError: print('Invalid input')
def get(self, *args, **kargs): #if check_permission(self): # project = ndb.Key(urlsafe=self.request.get("key")) project1 = self.session['current_project'] sprint_data = sprint.Sprint().get_by_project(project1) tasks = task.Task().get_all(project1) logging.info(tasks) release = project.ProjectRelease() releases = release.get_by_project(self.session['current_project']) self.render_template("user_new/apm-sprint-items.html", { "sprints": sprint_data, "tasks": tasks, "release": releases })
def post(self, *args, **kargs): task_data = task.Task() currentUser = self.auth.get_user_by_session() createdBy = self.user_model.get_by_id(currentUser['user_id']).key task_data.name = self.request.get('name') task_data.description = self.request.get('desc') task_data.actual_efforts = self.request.get('actual_efforts') if (self.request.get('complexity') != 'None'): task_data.complexity = ndb.Key( urlsafe=self.request.get('complexity')) if (self.request.get("start") != ''): task_data.startDate = datetime.strptime(self.request.get("start"), '%m/%d/%Y').date() if (self.request.get("end") != ''): task_data.endDate = datetime.strptime(self.request.get("end"), '%m/%d/%Y').date() if (self.request.get('assignee') != 'None'): task_data.assignee = ndb.Key(urlsafe=self.request.get('assignee')) if (self.request.get('sprint') != 'None'): task_data.sprint = ndb.Key(urlsafe=self.request.get('sprint')) if (self.request.get('user_story') != 'None'): task_data.user_story = ndb.Key( urlsafe=self.request.get('user_story')) # task_data.project = ndb.Key(urlsafe=self.request.get('key')) task_data.project = self.session['current_project'] task_data.createdby = createdBy task_data.type = ndb.Key(urlsafe=self.request.get('type')) task_data.task_status = "Open" task_data.created_by = currentUser['email_address'] task_data.status = True task_data.put() self.response.out.write("true")
def get(self,*args,**kargs): if check_permission(self): currentUser=self.auth.get_user_by_session() comp_key = self.user_model.get_by_id(currentUser['user_id']).tenant_key currentUser=self.user_model.get_by_id(currentUser['user_id']).key if not self.session.has_key('current_project'): projects= model.project.ProjectMembers().get_proj_by_user(comp_key,currentUser) if not projects: self.session['current_project']= None else: self.session['current_project']=projects[0].projectid projectKey=self.session['current_project'] else: projectKey=self.session['current_project'] #currentUser=self.auth.get_user_by_session() #currentUser=self.user_model.get_by_id(currentUser['user_id']).key if(projectKey != None): project_member=project.ProjectMembers().get_by_project_user(projectKey,currentUser) tasks=task.Task().get_by_project_user(projectKey,currentUser) open_count=0 inprogress_count =0 completed_count=0 for i in tasks: if i.task_status == 'Open': open_count=open_count+1 if i.task_status == 'In Progress': inprogress_count=inprogress_count+1 if i.task_status == 'Done': completed_count=completed_count+1 self.render_template("user_new/apm-user-dashboard.html",{"tasks":tasks,"open_count":open_count,"inprogress_count":inprogress_count,"completed_count":completed_count}) else: self.render_template("user_new/apm-user-dashboard.html",{"tasks":None,"open_count":0,"inprogress_count":0,"completed_count":0}) else: self.response.write("you are not allowed")