コード例 #1
0
ファイル: jobc.py プロジェクト: pratyushcloud/jobc
    def get(self, job_id):
        page = self.request.get("page")
        if job_id[0] == "/":
            job_id = job_id[1:]
        job = dbmodels.getJob(job_id)
        author = dbmodels.getPerson(job.person_linkedin_id)
        if not job:
            # throw some error
            self.redirect("/jobc")

        cookie_value = self.request.cookies.get(USERID_COOKIE)
        person = getUserFromCookie(cookie_value)
        params = setRealJDContent(job)
        params["user"] = ""
        if (
            person and author and person.linkedin_id == author.linkedin_id
        ):  # show edit link when author is the logged in user
            params["user"] = person.fname
        self.response.out.write(render_str("onejd.html", **params))
コード例 #2
0
ファイル: jobc.py プロジェクト: pratyushcloud/jobc
    def get(self, job_id):
        page = self.request.get("page")
        if job_id[0] == "/":
            job_id = job_id[1:]
        job = dbmodels.getJob(job_id)

        if not job:
            # some error here
            self.redirect("/jobc")

        author = dbmodels.getPerson(job.person_linkedin_id)
        cookie_value = self.request.cookies.get(USERID_COOKIE)
        person = getUserFromCookie(cookie_value)

        fullname = author.fname

        if (
            not author or not person or not person.linkedin_id == author.linkedin_id
        ):  # allow edit when author is the logged in user
            user = ""
            if person:
                user = person.fname
            self.response.out.write(render_str("authorlogin.html", user=user, author=fullname))
            return

        if not page:
            school = author.keyschool.schoolname
            location = author.location
            title = job.title
            logging.error("companyid")
            logging.error(job.company_id)
            company = dbmodels.getCompany(job.company_id).company_name
            sdate = job.sdate
            authorcheck = job.posted_by_text
            if authorcheck == "" or authorcheck.startswith("Alumnus"):
                authorcheck = "alum"
            logging.error("authorcheck " + authorcheck)
            if sdate:
                sdate = job.sdate.strftime("%m/%Y")
            edate = job.edate.strftime("%m/%Y")
            jd = job.dayinoffice
            jlove = job.jlove
            jhate = job.jhate
            jfunction = job.function
            self.response.out.write(
                render_str(
                    "jd.html",
                    user=fullname,
                    authorcheck=authorcheck,
                    schoolname=school,
                    oneself=fullname,
                    location=location,
                    school=school,
                    title=title,
                    company=company,
                    sdate=sdate,
                    edate=edate,
                    jhate=jhate,
                    jlove=jlove,
                    jd=jd,
                    jfunction=jfunction,
                )
            )
        elif page == "1":
            iq = job.interview_question
            ip = job.interview_process
            cvpoint = job.cvpoint
            eo = job.exit_option
            alum_base = job.alum_base
            stock = job.stock
            vsalary = job.variable_salary
            wop = job.work_opportunity
            wc = job.work_culture
            wsg = job.salary_growth
            wlb = job.work_life_balance
            fixed_salary = job.fixed_salary
            # logging.error("work culter = " + wc)
            self.response.out.write(
                render_str(
                    "jd2.html",
                    user=fullname,
                    wopcheck=wop,
                    iq=iq,
                    eo=eo,
                    abasecheck=alum_base,
                    wccheck=wc,
                    wsgcheck=wsg,
                    stockcheck=stock,
                    wlbcheck=wlb,
                    fsalary=fixed_salary,
                    ip=ip,
                    cvpoint=cvpoint,
                )
            )
コード例 #3
0
ファイル: jobc.py プロジェクト: pratyushcloud/jobc
def setRealJDContent(job):
    params = {}
    params["title"] = job.title
    company = dbmodels.getCompany(job.company_id)
    params["companyname"] = company.company_name
    params["companyurl"] = "http://www.linkedin.com/company/" + str(job.company_id)
    params["author"] = job.posted_by_text
    params["authorurl"] = ""
    if params["author"] == "self":
        person = dbmodels.getPerson(job.person_linkedin_id)
        params["author"] = person.fname + " (Alumnus of " + person.keyschool.schoolname + ")"
        params["authorurl"] = "href=http://www.linkedin.com/profile/view?id=" + person.linkedin_id

    params["date"] = job.modify_date.strftime("%m/%Y")
    params["jd"] = job.dayinoffice
    params["salary"] = "Fixed: " + job.fixed_salary + " Variable:" + job.variable_salary + " Stock: " + job.stock
    params["jlove"] = job.jlove
    params["jhate"] = job.jhate
    params["iq"] = job.interview_question
    params["cvpoint"] = job.cvpoint
    params["ip"] = job.interview_process
    params["eo"] = job.exit_option
    rating = {}
    if job.work_opportunity:
        rating[job.work_opportunity] = []
        rating[job.work_opportunity].append("work opportunity")
    if job.work_culture:
        if job.work_culture not in rating:
            rating[job.work_culture] = []
        rating[job.work_culture].append("work culture")
    if job.salary_growth:
        if job.salary_growth not in rating:
            rating[job.salary_growth] = []
        rating[job.salary_growth].append("salary growth")
    if job.work_life_balance:
        if job.work_life_balance not in rating:
            rating[job.work_life_balance] = []
        rating[job.work_life_balance].append("work life balance")

    rating_ex = rating2sentence(rating, "Excellent")
    rating_good = rating2sentence(rating, "Good")
    rating_ok = rating2sentence(rating, "Ok")
    rating_notok = rating2sentence(rating, "Notok")

    rating_sentence = ""
    if not rating_ex and not rating_good and not rating_notok and not rating_ok:
        params["rating_sentence"] = None
    else:
        rating_sentence = "I would rate this firm as "
        count_ratings = len(rating)
        i = 0
        if rating_ex:
            rating_sentence = rating_ex
        if rating_good:
            rating_sentence = rating_sentence + " " + rating_good
        if rating_ok:
            rating_sentence = rating_sentence + " " + rating_ok
        if rating_notok:
            rating_sentence = rating_sentence + " " + rating_notok
        params["rating_sentence"] = rating_sentence

    params["wc"] = job.work_culture
    params["wsg"] = job.salary_growth
    params["wlb"] = job.work_life_balance
    params["abase"] = job.alum_base
    params["wop"] = job.work_opportunity
    params["jdpage2"] = "/jobc/realjd/_edit/" + job.jobkey + "?page=1"
    params["jdpage1"] = "/jobc/realjd/_edit/" + job.jobkey
    return params