Skip to content

Commit

Permalink
feat(dev): user accustomed (#291)
Browse files Browse the repository at this point in the history
  • Loading branch information
eugena committed Jul 31, 2023
1 parent b42e55e commit 0821729
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion acesta/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@
</head>
<body>
{% block modals %}
{% request_modal subject=REQUEST_CONSULTATION %}
{% if not request.user.is_authenticated or not request.user.is_accustomed %}
{% request_modal subject=REQUEST_CONSULTATION %}
{% endif %}

{% with url=request.resolver_match.url_name %}
{% if url != 'terms' %}
Expand Down
2 changes: 2 additions & 0 deletions acesta/templates/include/request_button.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{% if not request.user.is_authenticated or not request.user.is_accustomed %}
<div class="request-button">
<a href="#" data-bs-toggle="modal" data-bs-target="#{{ REQUEST_CONSULTATION }}">
<svg width="124" height="124" viewBox="0 0 96 96" fill="none" xmlns="http://www.w3.org/2000/svg">
Expand All @@ -19,3 +20,4 @@
</svg>
</a>
</div>
{% endif %}
8 changes: 8 additions & 0 deletions acesta/user/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,14 @@ def is_extended(self) -> bool:
self.current_region.rank == 0 or self.current_region in self.regions.all()
)

@property
def is_accustomed(self) -> bool:
"""
Returns True if user is already experienced
:return: bool
"""
return self.date_joined + relativedelta(days=7) < now()

def update_period_info(self, period, order_regions, tourism_types):

period_info = self.period_info
Expand Down

0 comments on commit 0821729

Please sign in to comment.