Projet

Général

Profil

0001-templates-shorten-displayed-event-info-in-settings-4.patch

Valentin Deniaud, 12 août 2020 18:01

Télécharger (4,01 ko)

Voir les différences:

Subject: [PATCH] templates: shorten displayed event info in settings (#45573)

 .../chrono/manager_agenda_event_fragment.html       |  2 ++
 tests/test_manager.py                               | 13 ++++---------
 2 files changed, 6 insertions(+), 9 deletions(-)
chrono/manager/templates/chrono/manager_agenda_event_fragment.html
15 15
      {% if event.label %}{{ event.label }} / {% endif %}
16 16
    {% endif %}
17 17
    {{ event.start_datetime }}
18
    {% if not settings_view %}
18 19
    {% if event.places or event.waiting_list_places %}-{% endif %}
19 20
    {% if event.places %}
20 21
      {% blocktrans count remaining_places=event.remaining_places %}{{ remaining_places }} remaining place{% plural %}{{ remaining_places }} remaining places{% endblocktrans %}
......
26 27
      -
27 28
      {% blocktrans with places=event.waiting_list_places count booked_places=event.waiting_list %}{{ booked_places }}/{{ places }} booking{% plural %}{{ booked_places }}/{{ places }} bookings{% endblocktrans %})
28 29
    {% endif %}
30
    {% endif %}
29 31
    {% if settings_view and event.publication_date %}
30 32
    ({% trans "publication date:" %} {{ event.publication_date }})
31 33
    {% endif %}
tests/test_manager.py
1120 1120
    assert "This agenda doesn't have any event yet." not in resp.text
1121 1121
    assert '/manage/agendas/%s/events/%s/' % (agenda.id, event.id) in resp.text
1122 1122
    assert ('Feb. 15, %s, 5 p.m.' % year) in resp.text
1123
    assert '10 remaining places' in resp.text
1124
    assert '(0/10 bookings)' in resp.text
1125 1123

  
1126 1124
    resp_datetimes = app.get('/api/agenda/%s/datetimes/' % agenda.id)
1127 1125
    assert resp_datetimes.json['data'][0]['text'] == 'Feb. 15, %s, 5 p.m.' % year
......
1186 1184
    assert "This agenda doesn't have any event yet." not in resp.text
1187 1185
    assert '/manage/agendas/%s/events/%s/edit' % (agenda.id, event.id) in resp.text
1188 1186
    assert 'Feb. 15, 2016, 5 p.m.' in resp.text
1189
    assert '10 remaining places' in resp.text
1190
    assert '(0/10 bookings)' in resp.text
1191 1187
    assert event.duration is None
1192 1188
    assert event.end_datetime is None
1193 1189

  
......
1226 1222
    resp = resp.follow()
1227 1223
    assert '/manage/agendas/%s/events/%s/edit' % (agenda.id, event.id) in resp.text
1228 1224
    assert 'Feb. 16, 2016, 5 p.m.' in resp.text
1229
    assert '20 remaining places' in resp.text
1230
    assert '(0/20 bookings)' in resp.text
1231 1225
    event.refresh_from_db()
1226
    assert event.places == 20
1232 1227
    assert event.publication_date == datetime.date(2020, 5, 11)
1233 1228
    assert event.duration == 45
1234 1229
    assert event.end_datetime == event.start_datetime + datetime.timedelta(minutes=45)
......
1267 1262
    resp = resp.follow()
1268 1263
    assert '/manage/agendas/%s/events/%s/edit' % (agenda.id, event.id) in resp.text
1269 1264
    assert 'Feb. 16, 2016, 5 p.m.' in resp.text
1270
    assert '20 remaining places' in resp.text
1271
    assert '(0/20 bookings)' in resp.text
1272 1265
    event.refresh_from_db()
1273 1266
    assert event.publication_date is None
1274 1267

  
......
1281 1274
    Booking(event=event).save()
1282 1275
    Booking(event=event).save()
1283 1276
    app = login(app)
1284
    resp = app.get('/manage/agendas/%s/settings' % agenda.id, status=200)
1277

  
1278
    day = event.start_datetime
1279
    resp = app.get('/manage/agendas/%s/%d/%d/' % (agenda.id, day.year, day.month), status=200)
1285 1280
    assert '8 remaining places' in resp.text
1286 1281
    assert '(2/10 bookings)' in resp.text
1287 1282

  
1288
-