Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated functionality for job tracking #93

Merged
merged 1 commit into from
Jul 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 31 additions & 14 deletions app/jobs_posting.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@
def get_jp_data():
db = Database().db
cursor = db.cursor()
cursor.execute("select * from job_posting;")
if int(session["is_admin"]) == 2:
cursor.execute("select * from job_posting where company_name=\'"+ session['username']+ "';" )
# "select trip_id from trip natural join user where trip.is_booked=false and user.username='" + session['username'] + "';"
else:
cursor.execute("select * from job_posting;")
jp = [dict(jobid = row[0],name=row[1], description=row[2], address=row[3],salary=row[4]) for row in cursor.fetchall()]
return jp

Expand All @@ -32,7 +36,6 @@ def attractions():
@job_blueprint.route('/add-to-jobs/<jp_index>', methods=['POST'])
def add_to_trip(jp_index):
cursor = db.cursor()

cursor.execute("select * from job_posting;")
jp = [dict(id = row[0], name=row[1], description=row[2],address= row[3],salary=row[4]) for row in cursor.fetchall()] # TODO: Correctly map activity info.
jobid = jp[int(jp_index) - 1]['id']
Expand All @@ -54,19 +57,34 @@ def add_to_trip(jp_index):


# Delete an attraction
@job_blueprint.route('/delete-attraction/<jp_index>')
def delete_attraction(jp_index):

@job_blueprint.route('/delete-jobs/<jp_index>', methods=['POST'])
def delete_jobs(jp_index):
print("job posting ----------",jp_index)
# Get attraction_name
db = Database().db
cursor = db.cursor()
cursor.execute("select attraction.attraction_name from attraction natural join address;")
attraction_name = cursor.fetchall()[int(jp_index) - 1][0]
cursor.execute("delete from job_posting where job_id= " + jp_index + ";")
db.commit()
return redirect('/jobs')


# Delete from database
cursor.execute("delete from attraction where attraction_name='" + attraction_name + "';")
@job_blueprint.route('/review-jobs/<jp_index>', methods=['POST'])
def review_jobs(jp_index):
print("Review posting ----------",jp_index)
# Get attraction_name
db = Database().db
cursor = db.cursor()
cursor.execute("select * from job_applied where job_id= " + jp_index + ";")
db.commit()
return redirect(url_for('home'))
jp = [dict(id = row[1], name=row[2], description=row[3],address= row[4],salary=row[5],username= row[6]) for row in cursor.fetchall()] # TODO: Correctly map activity info.

return render_template('review_candidate.html',items=jp,jobid=jp_index, session=session)


@job_blueprint.route('/review-candidate/<jp_username>', methods=['POST'])
def review_candidate(jp_username):
return render_template('resume.html',username=jp_username, session=session)



@job_blueprint.route('/add-activity', methods=['GET'])
Expand All @@ -77,12 +95,11 @@ def add_activityt():
def create_activitys():

if request.method == 'POST':
activity_name = request.form['activity_name']
activity_name = session['username']
activity_desc = request.form['activity_desc']
activity_address = request.form['activity_address']
price = request.form['price']
price = request.form['price']
activity_object = Activity(activity_name, activity_desc, activity_address,price)
activity_object.save()
return redirect('/attractions')
return render_template('add_activity.html')
return redirect('/jobs')
return redirect('/jobs')
8 changes: 0 additions & 8 deletions app/resume.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,6 @@ def show_pdf(id=None):
if id is not None:
binary_pdf = UPLOAD_FOLDER+"/"+id+".pdf"
return send_from_directory(UPLOAD_FOLDER, id+".pdf")
# return redirect(binary_pdf)
# with open(binary_pdf, 'rb') as static_file:
# return send_file(static_file, session['username']+".pdf")
print(binary_pdf)
response = make_response(binary_pdf)
response.headers['Content-Type'] = 'application/pdf'
response.headers['Content-Disposition'] = 'inline; filename=%s' % binary_pdf
return response

db = Database().db

Expand Down