Skip to content

Commit

Permalink
Merge c732c58 into b4a29cc
Browse files Browse the repository at this point in the history
  • Loading branch information
tibetegya committed Jun 22, 2018
2 parents b4a29cc + c732c58 commit 5495578
Show file tree
Hide file tree
Showing 11 changed files with 317 additions and 24 deletions.
165 changes: 158 additions & 7 deletions wger/core/fixtures/days_of_week.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,200 @@
"pk": 1,
"model": "core.daysofweek",
"fields": {
"day_of_week": "Monday"
"day_of_week": "Monday",
"workout_plan": "micro"
}
},
{
"pk": 2,
"model": "core.daysofweek",
"fields": {
"day_of_week": "Tuesday"
"day_of_week": "Tuesday",
"workout_plan": "micro"
}
},
{
"pk": 3,
"model": "core.daysofweek",
"fields": {
"day_of_week": "Wednesday"
"day_of_week": "Wednesday",
"workout_plan": "micro"
}
},
{
"pk": 4,
"model": "core.daysofweek",
"fields": {
"day_of_week": "Thursday"
"day_of_week": "Thursday",
"workout_plan": "micro"
}
},
{
"pk": 5,
"model": "core.daysofweek",
"fields": {
"day_of_week": "Friday"
"day_of_week": "Friday",
"workout_plan": "micro"
}
},
{
"pk": 6,
"model": "core.daysofweek",
"fields": {
"day_of_week": "Saturday"
"day_of_week": "Saturday",
"workout_plan": "micro"
}
},
{
"pk": 7,
"model": "core.daysofweek",
"fields": {
"day_of_week": "Sunday"
"day_of_week": "Sunday",
"workout_plan": "micro"
}
},
{
"pk": 8,
"model": "core.daysofweek",
"fields": {
"day_of_week": "week 1",
"workout_plan": "meso"
}
},
{
"pk": 9,
"model": "core.daysofweek",
"fields": {
"day_of_week": "week 2",
"workout_plan": "meso"
}
},
{
"pk": 10,
"model": "core.daysofweek",
"fields": {
"day_of_week": "week 3",
"workout_plan": "meso"
}
},
{
"pk": 11,
"model": "core.daysofweek",
"fields": {
"day_of_week": "week 4",
"workout_plan": "meso"
}
},
{
"pk": 12,
"model": "core.daysofweek",
"fields": {
"day_of_week": "week 5",
"workout_plan": "meso"
}
},
{
"pk": 13,
"model": "core.daysofweek",
"fields": {
"day_of_week": "week 6",
"workout_plan": "meso"
}
},
{
"pk": 14,
"model": "core.daysofweek",
"fields": {
"day_of_week": "January",
"workout_plan": "macro"
}
},
{
"pk": 15,
"model": "core.daysofweek",
"fields": {
"day_of_week": "Febuary",
"workout_plan": "macro"
}
},
{
"pk": 16,
"model": "core.daysofweek",
"fields": {
"day_of_week": "March",
"workout_plan": "macro"
}
},
{
"pk": 17,
"model": "core.daysofweek",
"fields": {
"day_of_week": "April",
"workout_plan": "macro"
}
},
{
"pk": 18,
"model": "core.daysofweek",
"fields": {
"day_of_week": "May",
"workout_plan": "macro"
}
},
{
"pk": 19,
"model": "core.daysofweek",
"fields": {
"day_of_week": "June",
"workout_plan": "macro"
}
},
{
"pk": 20,
"model": "core.daysofweek",
"fields": {
"day_of_week": "July",
"workout_plan": "macro"
}
},
{
"pk": 21,
"model": "core.daysofweek",
"fields": {
"day_of_week": "August",
"workout_plan": "macro"
}
},
{
"pk": 22,
"model": "core.daysofweek",
"fields": {
"day_of_week": "September",
"workout_plan": "macro"
}
},
{
"pk": 23,
"model": "core.daysofweek",
"fields": {
"day_of_week": "October",
"workout_plan": "macro"
}
},
{
"pk": 24,
"model": "core.daysofweek",
"fields": {
"day_of_week": "November",
"workout_plan": "macro"
}
},
{
"pk": 252,
"model": "core.daysofweek",
"fields": {
"day_of_week": "December",
"workout_plan": "macro"
}
}
]
20 changes: 20 additions & 0 deletions wger/core/migrations/0015_daysofweek_workout_plan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-06-20 08:51
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('core', '0014_userprofile_is_activated'),
]

operations = [
migrations.AddField(
model_name='daysofweek',
name='workout_plan',
field=models.CharField(max_length=5, null=True),
),
]
2 changes: 2 additions & 0 deletions wger/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,8 @@ class DaysOfWeek(models.Model):
day_of_week = models.CharField(max_length=9,
verbose_name=_('Day of the week'))

workout_plan = models.CharField(max_length=5, null=True)

class Meta:
'''
Order by day-ID, this is needed for some DBs
Expand Down
4 changes: 2 additions & 2 deletions wger/core/templates/tags/render_day.html
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ <h4 class="media-heading">
<td colspan="2">
<a href="{% url 'manager:set:add' day.obj.id %}"
class="wger-modal-dialog btn btn-default btn-block wger-modal-dialog">
{% trans "No exercises selected for this day." %}
{% trans "No exercises selected for this cycle." %}
{% trans "Add one now." %}
</a>
</td>
Expand All @@ -139,7 +139,7 @@ <h4 class="media-heading">
<tr>
<td colspan="2">
<a href="{% url 'manager:set:add' day.obj.id %}"
class="wger-modal-dialog">{% trans "Add exercises to this workout day" %}</a>
class="wger-modal-dialog">{% trans "Add exercises to this workout cycle" %}</a>
</td>
</tr>
{% endif %}
Expand Down
25 changes: 25 additions & 0 deletions wger/manager/migrations/0011_auto_20180622_1228.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-06-22 09:28
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('manager', '0010_auto_20180620_1044'),
]

operations = [
migrations.AddField(
model_name='workout',
name='cycle_type',
field=models.CharField(choices=[('Microcycle', 'Microcycle - one week plan'), ('Mesocycle', 'Mesocycle - Two to six weeks plan'), ('Macrocycle', 'Macrocycle - one year plan')], default='', max_length=10),
),
migrations.AlterField(
model_name='workouttype',
name='category',
field=models.CharField(choices=[('1', 'Default'), ('2', 'Dropset')], default='1', max_length=10),
),
]
7 changes: 7 additions & 0 deletions wger/manager/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ class Workout(models.Model):
'''
Model for a training schedule
'''
CYCLE_OPTIONS = [
('Microcycle', 'Microcycle - one week plan'),
('Mesocycle', 'Mesocycle - Two to six weeks plan'),
('Macrocycle', 'Macrocycle - one year plan')
]

class Meta:
'''
Expand All @@ -68,6 +73,8 @@ class Meta:
"example 'Focus on back' or 'Week 1 of program xy'."))
user = models.ForeignKey(User, verbose_name=_('User'))

cycle_type = models.CharField(max_length=10, choices=CYCLE_OPTIONS, default='')

def get_absolute_url(self):
'''
Returns the canonical URL to view a workout
Expand Down
4 changes: 2 additions & 2 deletions wger/manager/templates/mobile/tags/render_day.html
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ <h4 class="media-heading">
{% if editable %}
<a href="{% url 'manager:set:add' day.obj.id %}"
class="list-group-item list-group-item-success wger-modal-dialog">
{% trans "No exercises selected for this day." %}<br>
{% trans "No exercises selected for this cycle." %}<br>
{% trans "Add one now." %}
</a>
{% endif %}
Expand All @@ -190,7 +190,7 @@ <h4 class="media-heading">
{% if editable %}
<a href="{% url 'manager:set:add' day.obj.id %}" class="list-group-item list-group-item-success wger-modal-dialog">
<span class="{% fa_class 'plus' %}"></span>
{% trans "Add exercises to this workout day" %}
{% trans "Add exercises to this workout cycle" %}
</a>
{% endif %}
{% endif %}
Expand Down
8 changes: 7 additions & 1 deletion wger/manager/templates/workout/overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
{% for workout in workouts %}
<a href="{{ workout.get_absolute_url }}" class="list-group-item">
<span class="glyphicon glyphicon-chevron-right pull-right"></span>

{% if workout == current_workout %}
<span class="badge">
<em>{% trans "active" %}</em>
Expand All @@ -19,6 +18,13 @@

<h4 class="list-group-item-heading">{{ workout }}</h4>
<p class="list-group-item-text">{{ workout.creation_date }}</p>
{% if workout.cycle_type == 'Microcycle' %}
<span class="label label-default">Micro Cycle</span>
{% elif workout.cycle_type == 'Mesocycle' %}
<span class="label label-primary">Meso Cycle</span>
{% elif workout.cycle_type == 'Macrocycle' %}
<span class="label label-success">Macro Cycle</span>
{% endif %}
</a>
{% empty %}
<a href="{% url 'manager:workout:add' %}" class="list-group-item">
Expand Down
Loading

0 comments on commit 5495578

Please sign in to comment.