Projet

Général

Profil

0003-visualization-add-truncated-previous-year-range-fixe.patch

Benjamin Dauvergne, 14 janvier 2019 12:32

Télécharger (5,66 ko)

Voir les différences:

Subject: [PATCH 3/3] visualization: add truncated previous year range (fixes
 #27407)

It goes from 01/01 to 31/12 of previous year, i.e. if we are the
01/01/2019 it matches 01/01/2018-31/12/2018.
 bijoe/locale/fr/LC_MESSAGES/django.po | 40 +++++++++++++++------------
 bijoe/visualization/forms.py          |  6 ++++
 tests/test_schema1.py                 | 25 +++++++++++++++++
 3 files changed, 54 insertions(+), 17 deletions(-)
bijoe/locale/fr/LC_MESSAGES/django.po
7 7
msgstr ""
8 8
"Project-Id-Version: bijoe 0.x\n"
9 9
"Report-Msgid-Bugs-To: \n"
10
"POT-Creation-Date: 2018-01-03 11:04+0000\n"
10
"POT-Creation-Date: 2019-01-14 10:01+0000\n"
11 11
"PO-Revision-Date: 2018-07-17 21:18+0200\n"
12 12
"Last-Translator: Benjamin Dauvergne <bdauvergne@entrouvert.com>\n"
13 13
"Language-Team: fr <fr@li.org>\n"
......
17 17
"Content-Transfer-Encoding: 8bit\n"
18 18
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
19 19

  
20
#: templates/bijoe/base.html:11 templates/bijoe/base.html.py:15
20
#: templates/bijoe/base.html:11 templates/bijoe/base.html:15
21 21
#: templates/bijoe/warehouse.html:5 views.py:79
22 22
msgid "Statistics"
23 23
msgstr "Statistiques"
......
26 26
msgid "Save visualization"
27 27
msgstr "Enregistrer une visualisation"
28 28

  
29
#: templates/bijoe/create_visualization.html:19 templates/bijoe/cube.html:65
29
#: templates/bijoe/create_visualization.html:19 templates/bijoe/cube.html:67
30 30
#: templates/bijoe/visualization.html:23
31 31
msgid "Save"
32 32
msgstr "Enregistrer"
......
41 41
msgid "Homepage"
42 42
msgstr "Accueil"
43 43

  
44
#: templates/bijoe/cube.html:48
44
#: templates/bijoe/cube.html:50
45 45
msgid "Visualiser"
46 46
msgstr "Visualiser"
47 47

  
48
#: templates/bijoe/cube.html:63 templates/bijoe/visualization.html:18
48
#: templates/bijoe/cube.html:65 templates/bijoe/visualization.html:18
49 49
msgid "URL for IFRAME"
50 50
msgstr "URL pour IFRAME"
51 51

  
52
#: templates/bijoe/cube.html:68
52
#: templates/bijoe/cube.html:70
53 53
msgid "Please choose some measures and groupings."
54 54
msgstr "Veuillez choisir des mesures et des regroupements."
55 55

  
......
120 120
msgid "last quarter"
121 121
msgstr "le trimestre précédent"
122 122

  
123
#: visualization/forms.py:93
123
#: visualization/forms.py:82
124
msgid "since 1st january last year"
125
msgstr "depuis le 1er janvier de l'année précédente"
126

  
127
#: visualization/forms.py:99
124 128
msgid "start"
125 129
msgstr "début"
126 130

  
127
#: visualization/forms.py:95
131
#: visualization/forms.py:101
128 132
msgid "end"
129 133
msgstr "fin"
130 134

  
131
#: visualization/forms.py:150
135
#: visualization/forms.py:156
132 136
msgid "Presentation"
133 137
msgstr "Représentation"
134 138

  
135
#: visualization/forms.py:151
139
#: visualization/forms.py:157
136 140
msgid "table"
137 141
msgstr "tableau"
138 142

  
139
#: visualization/forms.py:152
143
#: visualization/forms.py:158
140 144
msgid "chart"
141 145
msgstr "graphique"
142 146

  
143
#: visualization/forms.py:164
147
#: visualization/forms.py:170
144 148
msgid "Loop by"
145 149
msgstr "Regroupement(s)"
146 150

  
147
#: visualization/forms.py:185
151
#: visualization/forms.py:191
148 152
msgid "Group by horizontaly"
149 153
msgstr "Regroupement horizontal"
150 154

  
151
#: visualization/forms.py:190
155
#: visualization/forms.py:196
152 156
msgid "Group by vertically"
153 157
msgstr "Regroupement vertical"
154 158

  
155
#: visualization/forms.py:198
159
#: visualization/forms.py:204
156 160
msgid "Measure"
157 161
msgstr "Mesure"
158 162

  
159
#: visualization/forms.py:210
163
#: visualization/forms.py:216
160 164
msgid "You cannot use the same dimension for looping and grouping"
161
msgstr "Vous ne pouvez pas utiliser la même dimension pour la répétition et le regroupement."
165
msgstr ""
166
"Vous ne pouvez pas utiliser la même dimension pour la répétition et le "
167
"regroupement."
162 168

  
163 169
#: visualization/models.py:36
164 170
msgid "name"
bijoe/visualization/forms.py
77 77
        'start': u'le dernier trimestre',
78 78
        'end': u'ce trimestre',
79 79
    },
80
    {
81
        'value': 'since_1jan_last_year',
82
        'label': _('since 1st january last year'),
83
        'start': u'l\'année dernière',
84
        'end': u'maintenant',
85
    },
80 86
]
81 87

  
82 88

  
tests/test_schema1.py
28 28
        ['mois (Date)', 'janvier', u'f\xe9vrier', 'mars', 'avril', 'mai', 'juin', 'juillet', u'ao\xfbt'],
29 29
        ['number of rows', '10', '1', '1', '1', '1', '1', '1', '1'],
30 30
    ]
31

  
32

  
33
def test_truncated_previous_year_range(schema1, app, admin, freezer):
34
    login(app, admin)
35
    response = app.get('/').follow()
36
    response = response.click('Facts 1')
37
    form = response.form
38
    form.set('representation', 'table')
39
    form.set('measure', 'simple_count')
40
    form.set('drilldown_x', 'date__month')
41
    form.set('drilldown_y', 'date__year')
42
    form.set('filter__date_2', 'since_1jan_last_year')
43
    freezer.move_to('2019-01-01 01:00:00')
44
    response = form.submit('visualize')
45
    assert get_table(response) == [
46
        ['', 'Total'],
47
        ['Total', '0']
48
    ]
49
    freezer.move_to('2018-01-01 01:00:00')
50
    response = form.submit('visualize')
51
    assert get_table(response) == [
52
        ['', 'janvier', u'f\xe9vrier', 'mars', 'avril', 'mai', 'juin', 'juillet', u'ao\xfbt', 'Total'],
53
        ['2017', '10', '1', '1', '1', '1', '1', '1', '1', '17'],
54
        ['Total', '10', '1', '1', '1', '1', '1', '1', '1', '17'],
55
    ]
31
-