-
Notifications
You must be signed in to change notification settings - Fork 10
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
1648 rozbic osoby zapisane na grupy #1676
base: master-dev
Are you sure you want to change the base?
Conversation
{{ group.num_enrolled }}/{{group.limit}} | ||
niegwarantowanych{% for gs, taken_spots in spots_by_role %}{% if taken_spots != 0 %}, |
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.
Napis "N / M niegwarantowanych" wypisywałbym tylko pod warunkiem, że któraś z liczb N, M jest niezerowa (od razu mówię, że N > M = 0 jest technicznie możliwe wskutek ręcznych dopisków, zmian limitów etc.)
Obecnie metoda |
data = { | ||
'students_in_group': students_in_group, | ||
'students_in_queue': students_in_queue, | ||
'guaranteed_spots': enrolled_data.get('guaranteed_spots_rules'), | ||
'spots_by_role': [(gs, enrolled[group.pk][gs.role.name]) for gs in group.guaranteed_spots.all()], |
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.
Method returns a dictionary containing: | ||
int: Group index | ||
dict: A dictionary where: |
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.
Tu powinno się napisać, co w zewnętrznym słowniku jest kluczem, a co wartością.
{{students_in_group|length}}/{{group.total_limit}}{% if group.num_enrolled_by_role %}, w tym: | ||
{% if group.num_enrolled != 0 or group.limit != 0 %} | ||
{{ group.num_enrolled }}/{{group.limit}} | ||
niegwarantowanych{% endif %}{% for gs, taken_spots in spots_by_role %}{% if taken_spots != 0 %}, |
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.
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.
Wcześniej było ustalone, że wyświetlamy napis „n/m niegwarantowanych” jeżeli n lub m jest niezerowe, ale rzeczywiście chyba lepiej wyglądałoby bez tego.
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.
No ale podobnie "n/m dla isimu" chcemy zobaczyć przy m niezerowym nawet, jeśli n jest zerem.
student_roles = {r.name for r in set(student.groups.all()) & group_to_roles[group.id]} | ||
if not student_roles: | ||
student_roles = {""} | ||
enrolled[group.id] += Counter(student_roles) |
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.
Okazuje się, że +
dla Counter
ów usuwa te zera, które tak pracowicie dodajemy; żeby tego uniknąć, trzeba użyć nieco bardziej rozwlekłego .update()
(ale za to wtedy można podarować sobie jawne rzutowanie na Counter
).
enrolled[group.id] += Counter(student_roles) | |
enrolled[group.id].update(student_roles) |
…a liczby zapisanych studentów do grupy
Przed:
Po: