Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
nazmul-me committed Nov 27, 2024
2 parents 65a1f06 + 094038e commit 8898933
Show file tree
Hide file tree
Showing 5 changed files with 450 additions and 123 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Run tests and collect coverage
run: |
coverage run --source=tests -m unittest discover -s tests/
coverage run --source=app -m unittest discover -s tests/
coverage report
coverage xml
Expand Down
92 changes: 39 additions & 53 deletions app/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ def review():
jobs = [get_job_by_id(id.strip()) for id in review_ids]
jobs = [job for sublist in jobs for job in sublist]
else: jobs = get_all_jobs()
print(jobs)
return render_template('review-page.html', jobs=jobs)

@app.route('/job_recommendations')
Expand All @@ -139,41 +138,6 @@ def job_recommendations():

return render_template('review-page.html', jobs=recommended_reviews)


# view all
@app.route('/pageContent')
def page_content():
"""An API for the user to view all the reviews entered"""
intialize_db()
entries = get_all_jobs()
dept_filter_entries = JOBS_DB.distinct("department")
location_filter_entries = JOBS_DB.distinct("locations")
# title_filter_entries = JOBS_DB.distinct("title")
company_filter_entries = JOBS_DB.distinct("company")

# pagination

# print(entries)
page, per_page, offset = get_page_args(
page_parameter="page", per_page_parameter="per_page")
total = len(entries)

if not page or not per_page:
offset = 0
per_page = 10
pagination_entries = entries[offset: offset + per_page]
else:
pagination_entries = entries[offset: offset + per_page]
# print("ELSE!!!")

pagination = Pagination(page=page, per_page=per_page,
total=total, css_framework='bootstrap4')

return render_template('page_content.html', entries=pagination_entries, page=page,
per_page=per_page, pagination=pagination,
dept_filter_entries=dept_filter_entries,
location_filter_entries=location_filter_entries,
company_filter_entries=company_filter_entries)
def getCurrentTime():
"""A method to get current time"""
return datetime.now().replace(microsecond=0).strftime("%Y-%m-%d %H:%M:%S")
Expand Down Expand Up @@ -402,24 +366,10 @@ def myjobs():
# Check if 'username' is in session
if 'username' not in session:
return redirect('/login') # Redirect to login if not authenticated

entries = get_my_jobs(session['username'])
page, per_page, offset = get_page_args(
page_parameter="page", per_page_parameter="per_page")
total = len(entries)

if not page or not per_page:
offset = 0
per_page = 10
pagination_entries = entries[offset: offset + per_page]
else:
pagination_entries = entries[offset: offset + per_page]

pagination = Pagination(page=page, per_page=per_page,
total=total, css_framework='bootstrap4')

return render_template('myjobs.html', entries=pagination_entries, page=page,
per_page=per_page, pagination=pagination)

return render_template('myjobs.html', jobs=entries)


# Get the top jobs
Expand All @@ -435,6 +385,7 @@ def top_jobs():
or 0) + int(job.get("rating", 0) or 0),
reverse=True
)[:10]
print(top_job)
return render_template('top_jobs.html', jobs=top_job)


Expand Down Expand Up @@ -535,6 +486,41 @@ def dashboard():
ratings=ratings,
rating_counts=rating_counts)

# view all
@app.route('/pageContent')
def page_content():
"""An API for the user to view all the reviews entered"""
intialize_db()
entries = get_all_jobs()
dept_filter_entries = JOBS_DB.distinct("department")
location_filter_entries = JOBS_DB.distinct("locations")
# title_filter_entries = JOBS_DB.distinct("title")
company_filter_entries = JOBS_DB.distinct("company")

# pagination

# print(entries)
page, per_page, offset = get_page_args(
page_parameter="page", per_page_parameter="per_page")
total = len(entries)

if not page or not per_page:
offset = 0
per_page = 10
pagination_entries = entries[offset: offset + per_page]
else:
pagination_entries = entries[offset: offset + per_page]
# print("ELSE!!!")

pagination = Pagination(page=page, per_page=per_page,
total=total, css_framework='bootstrap4')

return render_template('page_content.html', entries=pagination_entries, page=page,
per_page=per_page, pagination=pagination,
dept_filter_entries=dept_filter_entries,
location_filter_entries=location_filter_entries,
company_filter_entries=company_filter_entries)

@app.route('/pageContentPost', methods=['POST'])
def page_content_post():
"""An API for the user to view specific reviews depending on the job title"""
Expand Down
Loading

0 comments on commit 8898933

Please sign in to comment.