Compare commits

..

2 Commits

Author SHA1 Message Date
Emmanuel Cazenave e5dace24d4 backoffice: display drafts stats (#72542)
gitea/wcs/pipeline/head This commit looks good Details
2024-03-05 15:21:25 +01:00
Thomas NOËL 00584bff12 help: add notes about include-anonymised parameter (#87766)
gitea/wcs/pipeline/head This commit looks good Details
2024-03-05 12:54:19 +01:00
3 changed files with 16 additions and 6 deletions

View File

@ -361,6 +361,16 @@ nest pas nécessaire de préciser lidentifiant dun utilisateur.
<input>GET https://www.example.net/api/forms/inscriptions/10/?anonymise</input>
</screen>
<p>
Par ailleurs, lAPI « Liste de formulaires » accepte un paramètre
<code>include-anonymised</code> permettant dinclure (<code>on</code>) ou non
(<code>off</code>) les demandes anonymisées dans la liste :
</p>
<screen>
<input>GET https://www.example.net/api/forms/inscriptions/list??include-anonymised=on</input>
</screen>
</section>
<section id="global-data">

View File

@ -1778,8 +1778,6 @@ class FormDefPage(Directory, TempfileDirectoryMixin):
context['deprecation_titles'] = deprecations.titles
temp_drafts = {}
total_drafts = 0
drafts = {}
for formdata in self.formdef.data_class().select_iterator(
clause=[Equal('status', 'draft')], itersize=200
):
@ -1787,10 +1785,12 @@ class FormDefPage(Directory, TempfileDirectoryMixin):
if page_id not in temp_drafts:
temp_drafts[page_id] = {'total': 0, 'page_no': int(formdata.page_no)}
temp_drafts[page_id]['total'] += 1
total_drafts += 1
total_drafts = sum(draft_info['total'] for draft_info in temp_drafts.values()) if temp_drafts else 0
drafts = {}
if total_drafts:
special_page_page_no_mapping = {
'_first_page': -100, # first
'_first_page': -1000, # first
'_unknown': 1000, # last
'_confirmation_page': 999, # second to last
}
@ -1813,7 +1813,7 @@ class FormDefPage(Directory, TempfileDirectoryMixin):
drafts['_unknown']['total'] += draft_info['total']
for draft_data in drafts.values():
draft_percent = 100 * draft_data['total'] / total_drafts
draft_data['percent'] = draft_percent
draft_data['percent'] = '%.1f' % draft_percent
draft_data['percent_rounded'] = '%d' % draft_percent
context['drafts'] = sorted(drafts.items(), key=lambda x: x[1]['page_no'])

View File

@ -114,7 +114,7 @@
{{ draft_data.field.ellipsized_label }}
{% endif %}
</td>
<td class="percent">{% blocktranslate with percent=draft_data.percent %}{{percent}}%{% endblocktranslate %}</td>
<td class="percent">{{ draft_data.percent }}{% trans "%" %}</td>
<td class="total">({{draft_data.total}}/{{drafts_total}})</td>
</tr>
<tr>