Skip to content
This repository has been archived by the owner on Feb 11, 2019. It is now read-only.

Commit

Permalink
Merge pull request #247 from rjacobs31/feature/redo-modules
Browse files Browse the repository at this point in the history
Allow redoing completed modules.
  • Loading branch information
dbreedt committed Sep 22, 2016
2 parents a400f38 + b0c86b9 commit 3f880d6
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 7 deletions.
11 changes: 11 additions & 0 deletions harambee/helper_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,17 @@ def get_harambee_journey_completed_modules(harambee, journey):
return HarambeeJourneyModuleRel.objects.filter(harambee=harambee, journey_module_rel__journey=journey,
state=HarambeeJourneyModuleRel.MODULE_COMPLETED)

def get_completed_active_module_data_by_journey(harambee, journey):
all_harambee_module_rel = HarambeeJourneyModuleRel.objects\
.filter(harambee=harambee, journey_module_rel__journey=journey, state=HarambeeJourneyModuleRel.MODULE_COMPLETED)

module_list_data = list()
for module_rel in all_harambee_module_rel:
module = get_module_data(module_rel)
module_list_data.append(module)

return module_list_data


#########################LEVELS#########################
def get_live_levels(journey_module_rel):
Expand Down
8 changes: 8 additions & 0 deletions harambee/static/css/harambee.css
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,14 @@ body {
border-radius:0 !important;
}

.img-button {
margin: 0;
padding: 0;
background-color: transparent;
vertical-align: middle;
border: none;
}

input[type="submit"] {
border-radius: 0 !important;
-webkit-appearance: none;
Expand Down
8 changes: 4 additions & 4 deletions harambee/templates/content/journey_home.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ <h2 class="line-heading">COMPLETED MODULES</h2>
<div>
{% for item in completed_modules %}
<div class="block">
<a class="line">
<a class="line" href="/module_home/{{ item.journey_slug }}/{{ item.module_slug }}">
<div>
<div>
<div class="image">
{% if item.journey_module_rel.module.image %}<img src="{{ item.journey_module_rel.module.image.url }}" alt="">{% endif %}
{% if item.image %}<img src="{{ item.image }}" alt="">{% endif %}
</div>
<p>
<span class="bold-font" style="color:{{ item.journey_module_rel.journey.colour }}">{{ item.journey_module_rel.module.name | upper }}</span><br>
<span {% if item.journey_module_rel.journey.colour %} style="color:{{ item.journey_module_rel.journey.colour}}"{% endif %}>{{ item.journey_module_rel.module.total_levels }} </span>of {{ item.journey_module_rel.module.total_levels }} Levels Completed
<span class="bold-font" style="color:{{ item.journey_colour }}">{{ item.module_name | upper }}</span><br>
<span {% if item.journey_colour %} style="color:{{ item.journey_colour}}"{% endif %}>{{ item.total_levels }} </span>of {{ item.total_levels }} Levels Completed
</p>
<div><img class="small-image" src='/static/img/tick.png'></div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion harambee/templates/content/module_home.html
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ <h3 class="line-heading">{{ active.name |upper }}</h3>
{% if active.percent_correct != 100 %}
<button type="submit" class="right-link-button border black-border hand-pointer yellow-back white-front bold-font">REDO</button>
{% else %}
<img class="small-image" src='/static/img/tick.png'>
<button type="submit" class="img-button hand-pointer"><img class="small-image" style="margin-top:1px;" src='/static/img/tick.png'></button>
{% endif %}
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions harambee/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
get_harambee_completed_modules, get_harambee_active_levels,\
get_harambee_locked_levels, get_level_data, get_module_data, get_module_data_from_queryset,\
unlock_first_level, has_completed_all_modules, get_journey_module, get_harambee_journey_completed_modules,\
get_active_module_data_by_journey
get_active_module_data_by_journey, get_completed_active_module_data_by_journey
from rolefit.communication import *
from random import randint, choice
from django.db.models import Q
Expand Down Expand Up @@ -539,7 +539,7 @@ def get_context_data(self, **kwargs):
item.new = (timezone.now() - item.module.start_date).days < 30
context["new_modules"] = new_modules
context["module_list"] = get_active_module_data_by_journey(harambee, journey)
context["completed_modules"] = get_harambee_journey_completed_modules(harambee, self.object)
context["completed_modules"] = get_completed_active_module_data_by_journey(harambee, journey)
context["header_colour"] = "black-back"
context["hide"] = False
return context
Expand Down

0 comments on commit 3f880d6

Please sign in to comment.