-
-
Notifications
You must be signed in to change notification settings - Fork 547
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added fedora instruction + secondary muscle #282
Changes from 2 commits
7058422
594abbd
22cf061
692477e
ce5c0e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -117,6 +117,8 @@ def canonical_representation(self): | |
day_canonical_repr = [] | ||
muscles_front = [] | ||
muscles_back = [] | ||
muscles_front_secondary = [] | ||
muscles_back_secondary = [] | ||
|
||
# Sort list by weekday | ||
day_list = [i for i in self.day_set.select_related()] | ||
|
@@ -132,13 +134,19 @@ def canonical_representation(self): | |
for i in canonical_repr_day['muscles']['back']: | ||
if i not in muscles_back: | ||
muscles_back.append(i) | ||
for i in canonical_repr_day['muscles']['frontsecondary']: | ||
if i not in muscles_front_secondary: | ||
muscles_front_secondary.append(i) | ||
for i in canonical_repr_day['muscles']['backsecondary']: | ||
if i not in muscles_back_secondary: | ||
muscles_back_secondary.append(i) | ||
|
||
day_canonical_repr.append(canonical_repr_day) | ||
|
||
workout_canonical_form = {'obj': self, | ||
'muscles': {'front': muscles_front, 'back': muscles_back}, | ||
'muscles': {'front': muscles_front, 'back': muscles_back, 'frontsecondary':muscles_front_secondary, 'backsecondary': muscles_back_secondary }, | ||
'day_list': day_canonical_repr} | ||
|
||
print(workout_canonical_form) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should remove this debug line |
||
# Save to cache | ||
cache.set(cache_mapper.get_workout_canonical(self.pk), workout_canonical_form) | ||
|
||
|
@@ -426,6 +434,9 @@ def get_canonical_representation(self): | |
canonical_repr = [] | ||
muscles_front = [] | ||
muscles_back = [] | ||
muscles_front_secondary = [] | ||
muscles_back_secondary = [] | ||
|
||
|
||
for set_obj in self.set_set.select_related(): | ||
exercise_tmp = [] | ||
|
@@ -440,6 +451,12 @@ def get_canonical_representation(self): | |
elif not muscle.is_front and muscle.id not in muscles_back: | ||
muscles_back.append(muscle.id) | ||
|
||
for muscle in exercise.muscles_secondary.all(): | ||
if muscle.is_front and muscle.id not in muscles_front: | ||
muscles_front_secondary.append(muscle.id) | ||
elif not muscle.is_front and muscle.id not in muscles_back: | ||
muscles_back_secondary.append(muscle.id) | ||
|
||
for setting in Setting.objects.filter(set=set_obj, | ||
exercise=exercise).order_by('order', 'id'): | ||
setting_tmp.append(setting) | ||
|
@@ -495,7 +512,9 @@ def get_canonical_representation(self): | |
'has_settings': has_setting_tmp, | ||
'muscles': { | ||
'back': muscles_back, | ||
'front': muscles_front | ||
'front': muscles_front, | ||
'frontsecondary': muscles_front_secondary, | ||
'backsecondary': muscles_front_secondary | ||
}}) | ||
|
||
# Days of the week | ||
|
@@ -510,7 +529,9 @@ def get_canonical_representation(self): | |
'day_list': tmp_days_of_week}, | ||
'muscles': { | ||
'back': muscles_back, | ||
'front': muscles_front | ||
'front': muscles_front, | ||
'frontsecondary': muscles_front_secondary, | ||
'backsecondary': muscles_front_secondary | ||
}, | ||
'set_list': canonical_repr} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,6 +93,14 @@ def view(request, pk): | |
if i not in muscles_back: | ||
muscles_back.append('images/muscles/main/muscle-{0}.svg'.format(i)) | ||
|
||
for i in canonical['muscles']['frontsecondary']: | ||
if i not in muscles_front: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The only thing am I'm not sure about is that if a workout has exercises that train a muscle as the main and the secondary muscle, the result is a bit fuzzy with the colors. I would suggest that we only colour the secondary muscles if there are no main ones, something like this: if i not in muscles_front and i not in canonical['muscles']['front']:
[...] The same below |
||
muscles_front.append('images/muscles/secondary/muscle-{0}.svg'.format(i)) | ||
for i in canonical['muscles']['backsecondary']: | ||
if i not in muscles_back: | ||
muscles_back.append('images/muscles/secondary/muscle-{0}.svg'.format(i)) | ||
|
||
|
||
# Append the silhouette of the human body as the last entry so the browser | ||
# renders it in the background | ||
muscles_front.append('images/muscles/muscular_system_front.svg') | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better remove this :)