Ejemplo n.º 1
0
    def get(self, *args, **kargs):
        #if check_permission(self):
        key = self.session['current_project']
        type_data = task.Type().get_all()
        team = project.ProjectMembers().get_all(key)
        complexity = project.Estimation().get_all(key)
        logging.info(complexity)
        sprints = sprint.Sprint().get_by_project(key)

        self.render_template(
            "user_new/addtask.html", {
                "type": type_data,
                "team": team,
                "complex": complexity,
                'sprints': sprints
            })
    def get(self, *args, **kargs):

        projectkey = ndb.Key(urlsafe=self.request.get("key"))
        project_list = projectkey.get()

        logging.info("test")
        estimation = project.Estimation()
        esti = estimation.query(
            project.Estimation.projectid == projectkey).fetch()

        logging.info(esti)

        self.render_template("editproject.html", {
            "project": project_list,
            "estimation": esti
        })
Ejemplo n.º 3
0
 def get(self, *args, **kargs):
     #if check_permission(self):
     edit_key = ndb.Key(urlsafe=self.request.get('edit_key'))
     task_data = edit_key.get()
     key = self.session['current_project']
     type_data = task.Type().get_all()
     team = project.ProjectMembers().get_all(key)
     complexity = project.Estimation().get_all(key)
     sprints = sprint.Sprint().get_by_project(key)
     self.render_template(
         "user_new/edittask.html", {
             "type": type_data,
             "team": team,
             "complex": complexity,
             'sprints': sprints,
             'task_data': task_data
         })
    def get(self, *args, **kargs):
        currentUser = self.auth.get_user_by_session()
        logging.info("it is here proj " + self.request.get("proj_id"))
        projkey = int(self.request.get("proj_id"))
        projmodel = project.Project()
        proj = projmodel.get_proj(projkey)

        #proj.startDate = proj.startDate.strftime('%d/%m/%Y')
        #proj.endDate =   proj.endDate.strftime('%d/%m/%Y')
        logging.info("it is here proj " + proj.__str__())

        estimationmodel = project.Estimation()
        esti = estimationmodel.get_all(ndb.Key('Project', projkey))

        projectmembermodel = project.ProjectMembers()
        projmem = projectmembermodel.get_active(ndb.Key('Project', projkey))

        groupmodel = user.Groups().query(
            ndb.AND(
                user.Groups.tenant_key == self.user_model.get_by_id(
                    currentUser['user_id']).tenant_key,
                user.Groups.application_level == False,
                user.Groups.status == True)).fetch()
        groupmodel1 = user.Groups().query(
            ndb.AND(user.Groups.tenant_key == None,
                    user.Groups.application_level == False,
                    user.Groups.status == True)).fetch()
        groupmodel.extend(groupmodel1)
        currentUser = self.auth.get_user_by_session()
        usermodel = user.OurUser().query(
            ndb.AND(
                user.OurUser.tenant_key == self.user_model.get_by_id(
                    currentUser['user_id']).tenant_key,
                user.OurUser.status == True)).fetch()
        for usr in usermodel:
            for mem in projmem:
                if (usr.key == mem.userid):
                    usermodel.remove(usr)
        self.render_template(
            "user_new/viewproject.html", {
                "project": proj,
                "userslist": usermodel,
                'estimation': esti,
                'projmem': projmem,
                'roles': groupmodel
            })
    def post(self, *args, **kargs):
        currentUser = self.auth.get_user_by_session()
        logging.info("it is here " + self.request.__str__())
        complexity = self.request.get("complexity")
        points = self.request.get("points")
        efforts = self.request.get("efforts")
        projid = self.request.get("projid")
        logging.info("it is here and the userId is" + complexity)
        logging.info("it is here and the projid is" + points)
        logging.info("it is here and the role is" + efforts)

        companyId = self.user_model.get_by_id(
            currentUser['user_id']).tenant_key

        estimation = project.Estimation()
        estimation.projectid = ndb.Key('Project', int(projid))
        estimation.companyid = companyId
        estimation.estimationLevel = complexity
        estimation.estimationPoint = int(points)
        estimation.estimationHours = float(efforts)

        estimation.created_by = currentUser['email_address']
        estimation.status = True

        estimateskey = estimation.set()

        estimatesmodel = estimateskey.get()

        data = {}
        data['id'] = estimatesmodel.key.id()
        data['projectid'] = estimatesmodel.projectid.id()
        data['companyid'] = estimatesmodel.companyid.id()
        data['estimationLevel'] = estimatesmodel.estimationLevel
        data['estimationPoint'] = estimatesmodel.estimationPoint
        data['estimationHours'] = estimatesmodel.estimationHours

        self.response.write(json.dumps(data, ensure_ascii=False))
    def post(self, *args, **kargs):
        logging.info("it is here " + self.request.__str__())
        currentUser = self.auth.get_user_by_session()
        companyId = self.user_model.get_by_id(
            currentUser['user_id']).tenant_key
        logging.info(currentUser)
        logging.info(companyId)
        logging.info(self.request.get("proj_start"))
        projec = project.Project()
        projec.companyid = companyId
        projec.name = self.request.get("proj_name")
        projec.description = self.request.get("proj_desc")
        projec.startDate = datetime.strptime(self.request.get("proj_start"),
                                             '%m/%d/%Y').date()
        projec.endDate = datetime.strptime(self.request.get("proj_end"),
                                           '%m/%d/%Y').date()

        projec.created_by = currentUser['email_address']
        projec.status = True
        #projec.team = (self.request.get("proj_team")).split(",")
        projkey = projec.set()
        #logging.info(projkey)
        estimation = project.Estimation()
        estimation.projectid = projkey
        estimation.companyid = companyId
        estimation.estimationLevel = "Very Simple"
        estimation.estimationPoint = 1
        estimation.estimationHours = 1.0
        estimation.created_by = currentUser['email_address']
        estimation.status = True
        estimation.set()

        estimation = project.Estimation()
        estimation.projectid = projkey
        estimation.companyid = companyId
        estimation.estimationLevel = "Simple"
        estimation.estimationPoint = 1
        estimation.estimationHours = 1.0
        estimation.created_by = currentUser['email_address']
        estimation.status = True
        estimation.set()

        estimation = project.Estimation()
        estimation.projectid = projkey
        estimation.companyid = companyId
        estimation.estimationLevel = "Medium"
        estimation.estimationPoint = 1
        estimation.estimationHours = 1.0
        estimation.created_by = currentUser['email_address']
        estimation.status = True
        estimation.set()

        estimation = project.Estimation()
        estimation.projectid = projkey
        estimation.companyid = companyId
        estimation.estimationLevel = "Complex"
        estimation.estimationPoint = 1
        estimation.estimationHours = 1.0
        estimation.created_by = currentUser['email_address']
        estimation.status = True
        estimation.set()

        estimation = project.Estimation()
        estimation.projectid = projkey
        estimation.companyid = companyId
        estimation.estimationLevel = "Very Complex"
        estimation.estimationPoint = 1
        estimation.estimationHours = 1.0
        estimation.created_by = currentUser['email_address']
        estimation.status = True
        estimation.set()

        projemem = project.ProjectMembers()
        projemem.userName = self.user_model.get_by_id(
            currentUser['user_id']).name
        projemem.projectid = projkey
        projemem.companyid = companyId
        projemem.userid = self.user_model.get_by_id(currentUser['user_id']).key
        group = user.Groups()
        groupmodel = group.get_default_role()
        for g in groupmodel:
            projemem.userRole = g.role
            projemem.roleid = g.key
        projemem.created_by = currentUser['email_address']
        projemem.status = True
        projemem.set()

        self.response.write(projkey.id())