0001-general-don-t-display-repeated-status-in-journal-918.patch
tests/test_form_pages.py | ||
---|---|---|
2208 | 2208 |
resp = app.post(formdata.get_url() + 'jump/trigger/XXX', status=302) |
2209 | 2209 | |
2210 | 2210 |
assert formdef.data_class().get(formdata.id).status == 'wf-st2' |
2211 | ||
2212 |
def test_form_worklow_multiple_identical_status(pub): |
|
2213 |
user = create_user(pub) |
|
2214 | ||
2215 |
formdef = create_formdef() |
|
2216 |
formdef.fields = [] |
|
2217 |
formdef.store() |
|
2218 | ||
2219 |
workflow = Workflow(name='test') |
|
2220 |
st1 = workflow.add_status('Status1', 'st1') |
|
2221 |
jump = JumpWorkflowStatusItem() |
|
2222 |
jump.trigger = 'XXX' |
|
2223 |
jump.status = 'st1' |
|
2224 |
st1.items.append(jump) |
|
2225 |
jump.parent = st1 |
|
2226 |
workflow.store() |
|
2227 | ||
2228 |
formdef.workflow_id = workflow.id |
|
2229 |
formdef.store() |
|
2230 | ||
2231 |
formdef.data_class().wipe() |
|
2232 |
formdata = formdef.data_class()() |
|
2233 |
formdata.just_created() |
|
2234 |
formdata.store() |
|
2235 |
assert formdef.data_class().get(formdata.id).status == 'wf-st1' |
|
2236 | ||
2237 |
app = get_app(pub) |
|
2238 | ||
2239 |
Role.wipe() |
|
2240 |
role = Role(name='xxx') |
|
2241 |
role.store() |
|
2242 | ||
2243 |
jump.by = [role.id] |
|
2244 |
workflow.store() |
|
2245 |
user.roles = [role.id] |
|
2246 |
user.store() |
|
2247 | ||
2248 |
login(app, username='foo', password='foo') |
|
2249 |
resp = app.post(formdata.get_url() + 'jump/trigger/XXX', status=302) |
|
2250 |
resp = app.post(formdata.get_url() + 'jump/trigger/XXX', status=302) |
|
2251 |
resp = app.post(formdata.get_url() + 'jump/trigger/XXX', status=302) |
|
2252 | ||
2253 |
assert len(formdef.data_class().get(formdata.id).evolution) == 4 |
|
2254 |
assert formdef.data_class().get(formdata.id).status == 'wf-st1' |
|
2255 | ||
2256 |
resp = app.get(formdata.get_url()) |
|
2257 |
assert resp.body.count('Status1') == 2 # once in summary and once in journal |
wcs/forms/common.py | ||
---|---|---|
243 | 243 |
r += htmltext('<h2 class="foldable">%s</h2>') % _('Log') |
244 | 244 |
r += htmltext('<ul id="evolutions">') |
245 | 245 |
hidden = False |
246 |
previous_status = None |
|
246 | 247 |
for evo in self.filled.evolution: |
247 | 248 |
if evo.status: |
248 | 249 |
wf_status = self.filled.get_status(evo.status) |
... | ... | |
277 | 278 | |
278 | 279 |
r += htmltext('<li class="%s">' % klass) |
279 | 280 |
r += htmltext('<div>') |
281 | ||
282 |
status_block = TemplateIO(html=True) |
|
280 | 283 |
if evo.status: |
281 |
r += htmltext('<div class="evolution-metadata">') |
|
282 |
r += htmltext('<span class="status">%s</span> ') % self.filled.get_status_label(evo.status) |
|
283 |
r += htmltext('<span class="time">%s</span> ') % misc.localstrftime(evo.time) |
|
284 |
r += htmltext('</div>') # <-- .evolution-metadata --> |
|
284 |
status_block += htmltext('<div class="evolution-metadata">') |
|
285 |
status_block += htmltext('<span class="status">%s</span> ' |
|
286 |
) % self.filled.get_status_label(evo.status) |
|
287 |
status_block += htmltext('<span class="time">%s</span> ' |
|
288 |
) % misc.localstrftime(evo.time) |
|
289 |
status_block += htmltext('</div>') # <-- .evolution-metadata --> |
|
290 | ||
285 | 291 |
parts = TemplateIO(html=True) |
286 | 292 |
if evo_author: |
287 | 293 |
parts += htmltext('<span class="user">%s') % evo_author |
... | ... | |
305 | 311 |
parts += t |
306 | 312 | |
307 | 313 |
parts_value = parts.getvalue() |
314 |
if parts_value or evo.status != previous_status: |
|
315 |
previous_status = evo.status |
|
316 |
r += status_block.getvalue() |
|
317 | ||
308 | 318 |
if parts_value: |
309 | 319 |
r += htmltext('<div class="msg">') |
310 | 320 |
r += htmltext(parts_value) |
311 |
- |