Skip to content

Commit

Permalink
Merge pull request #11 from ruben69695/fix/present-jobs
Browse files Browse the repository at this point in the history
Added a fix to be able to show the present jobs in experience feature
  • Loading branch information
ruben69695 authored Oct 15, 2023
2 parents 815a31f + 614186e commit a314c2b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ share/python-wheels/
.installed.cfg
*.egg
MANIFEST
.idea

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down
7 changes: 6 additions & 1 deletion experience/templates/experience/experience.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ <h6 class="card-subtitle fst-light">{{ experience.job.company }}</h6>
</div>
{% comment %} <p class="card-text">{{ experience.job.description }}</p> {% endcomment %}
<p class="card-text">
<small class="text-start">{{ experience.job.from_date }}</small>{% if experience.job.to_date %}<small> - {{ experience.job.to_date }}</small>{% endif %}
<small class="text-start">{{ experience.job.from_date }}</small>
{% if experience.job.to_date %}
<small> - {{ experience.job.to_date }}</small>
{% else %}
<small> - Present</small>
{% endif %}
</p>
</div>
<div class="card-footer experience-footer">
Expand Down
8 changes: 5 additions & 3 deletions experience/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

DAYS_YEAR = 365


# Create your views here.


Expand All @@ -16,12 +17,13 @@ def experience(request):
return render(request, "experience/experience.html", {'experiences': experiences})


class ExperienceView():
class ExperienceView:

def __init__(self, job):
self.job = job
duration = job.to_date - job.from_date if job.to_date else datetime(datetime(
).utcnow().year, datetime().utcnow().month, datetime().utcnow().day) - job.from_date
duration = job.to_date - job.from_date if job.to_date else datetime(datetime.utcnow().year,
datetime.utcnow().month,
datetime.utcnow().day).date() - job.from_date
self.years = int(duration.days / DAYS_YEAR)
self.months = int(((duration.days / DAYS_YEAR) * 12) -
(int(duration.days / DAYS_YEAR) * 12))

0 comments on commit a314c2b

Please sign in to comment.