def api_get_info_about_company_review(login): check = GetCompany.check_such_user_company(login) if login != 0: id_company = GetCompany.get_company_id_from_db(login) name = GetCompany.get_company_name_from_db(login) email = GetCompany.get_company_email_from_db(login) web_site = GetCompany.get_company_web_site(id_company) city = GetCompany.get_company_city(id_company) country = GetCompany.get_company_country(id_company) about_company = GetCompany.get_about_company(id_company) photo = GetCompany.get_photo_company(id_company) check = GetCompany.get_check_company(login) if photo is None: photo = 'http://placehold.it/500x500' else: photo = photo company = { 'name': name, 'email': email, 'website': web_site, 'city': city, 'country': country, 'about_company': about_company, 'check': check, 'photo': photo } courses = GetCompany.get_company_course(id_company) courses_response = [] for course in courses: course = { 'name': course[0], 'status': course[2], 'url': '/course/!' + str(course[1]) + "/!" + str(id_company) } courses_response.append(course) return render_template("profile-c-reviews.html", company=company, courses=courses_response) else: return 'Not such user'
def api_info_about_company(login): if login == "": return jsonify(status="User`s login is null"), 404 else: id_company = GetCompany.get_company_id_from_db(login) if id_company == 0: return 'Not such User in db' else: result = CompanySession.check_in_session_company() if result == 0: return "Please log in" if result == login: name = GetCompany.get_company_name_from_db(login) email = GetCompany.get_company_email_from_db(login) web_site = GetCompany.get_company_web_site(id_company) city = GetCompany.get_company_city(id_company) country = GetCompany.get_company_country(id_company) about_company = GetCompany.get_about_company(id_company) photo = GetCompany.get_photo_company(id_company) check = GetCompany.get_check_company(login) courses = GetCompany.get_company_course(id_company) courses_response = [] for course in courses: course = { 'name': course[0], 'status': course[2], 'url': '/course/!' + str(course[1]) + "/!" + str(id_company) } courses_response.append(course) if photo is None: photo = 'http://placehold.it/500x500' else: photo = photo if check == 0: check = "color:transparent" company = { 'name': name, 'email': email, 'website': web_site, 'city': city, 'country': country, 'about_company': about_company, 'check': check, 'photo': photo } return render_template("profile-c.html", company=company, courses=courses_response) if check == 1: check = "color:grey" company = { 'name': name, 'email': email, 'website': web_site, 'city': city, 'country': country, 'about_company': about_company, 'check': check, 'photo': photo } return render_template("profile-c.html", company=company, courses=courses_response) else: return 'Please log in'