Skip to content

Commit

Permalink
인증 성공시 별20 획득, 완료된 목표 처리
Browse files Browse the repository at this point in the history
  • Loading branch information
dddooo9 committed Aug 28, 2021
1 parent 8c13827 commit 1f18100
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions groups/templates/groups/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ <h4 class="text_center">참여인원: {{ member_count }}</h4>
<h1 class="text_center">{{ goal.name }}</h1>
<h3 class="text_center">하루 {{ goal.goal_page }}페이지 독서하기</h3>
</div> -->
{% if 30 >= start_days %}
<div class="psn_boxes">
<div class="psn_box start">
시작<br><span class="psn_day">{{ start_days }}</span><br>일째
Expand All @@ -107,6 +108,11 @@ <h3 class="text_center">하루 {{ goal.goal_page }}페이지 독서하기</h3>
성공<br><span class="psn_day">{{ success_days }}</span><br>일째
</div>
</div>
{% else %}
<div class="psn_boxes">
<h2>{{dates|index_1:0}} ~ {{dates|index_1:29}}</h2>
</div>
{% endif %}
<div class="psn_check table_container">
<table>
<thead>
Expand Down Expand Up @@ -191,9 +197,11 @@ <h1>여기</h1>
</section>
</div>

{% if 30 >= start_days %}
<div class="goal_verify">
<a class="btn1" href="{% url 'groups:certify' goal.id %}">인증하기</a>
</div>
{% endif %}

<!-- The Modal -->
<div id="myModal" class="modal">
Expand Down
3 changes: 3 additions & 0 deletions groups/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ def certify(request, goal_id):
else: # 이하여야 성공
if float(figure) > goal.value:
achievement = False
if achievement:
user.profile.cash += 20
user.profile.save()
Certify.objects.create(goal=goal, user=user, created=created, text=text, image=image, figure=figure, achievement=achievement)
return redirect('groups:main', goal_id)
return render(request, 'groups/certify.html', {'goal': goal})
Expand Down

0 comments on commit 1f18100

Please sign in to comment.