comparison bug-list.xsl @ 12:52b34ea50eff default tip

sync: work time projection doesn't seem to be working anyway
author cin
date Sun, 13 Sep 2015 19:37:16 +0300
parents 4eb9fdf4efa9
children
comparison
equal deleted inserted replaced
11:4eb9fdf4efa9 12:52b34ea50eff
114 <xsl:element name="bug"> 114 <xsl:element name="bug">
115 <xsl:attribute name="id"><xsl:value-of select="$id" /></xsl:attribute> 115 <xsl:attribute name="id"><xsl:value-of select="$id" /></xsl:attribute>
116 <xsl:attribute name="desc"><xsl:value-of select="summary" /></xsl:attribute> 116 <xsl:attribute name="desc"><xsl:value-of select="summary" /></xsl:attribute>
117 <xsl:attribute name="estimated"><xsl:value-of 117 <xsl:attribute name="estimated"><xsl:value-of
118 select="number((time/estimated | estimated_time)[1])" /></xsl:attribute> 118 select="number((time/estimated | estimated_time)[1])" /></xsl:attribute>
119 <xsl:attribute name="complete"><xsl:value-of select="status = 'RESOLVED' or status = 'VERIFIED'"/></xsl:attribute>
119 120
120 <xsl:if test="$children"> 121 <xsl:if test="$children">
121 <xsl:attribute name="group"><xsl:value-of select="boolean($children)" /></xsl:attribute> 122 <xsl:attribute name="group"><xsl:value-of select="boolean($children)" /></xsl:attribute>
122 123
123 <xsl:for-each select="$children"> 124 <xsl:for-each select="$children">
138 </xsl:element> 139 </xsl:element>
139 </xsl:template> 140 </xsl:template>
140 141
141 <!-- output --> 142 <!-- output -->
142 <xsl:template match="/"> 143 <xsl:template match="/">
143 <xsl:apply-templates select="exsl:node-set($structure)/bug"> 144 <xsl:apply-templates select="exsl:node-set($structure)/node()">
144 <xsl:with-param name="indent" select="0" /> 145 <xsl:with-param name="indent" select="0" />
145 <xsl:with-param name="chargeset" select="$chargeset" /> 146 <xsl:with-param name="chargeset" select="$chargeset" />
146 </xsl:apply-templates> 147 </xsl:apply-templates>
148 <!--
149 <xsl:apply-templates select="bugzilla/timesheet">
150 <xsl:with-param name="indent" select="0" />
151 </xsl:apply-templates>
152 -->
147 </xsl:template> 153 </xsl:template>
148 154
149 <!-- task --> 155 <!-- task -->
150 <xsl:template match="bug"> 156 <xsl:template match="bug">
151 <xsl:param name="indent" select="0" /> 157 <xsl:param name="indent" select="0" />
257 <xsl:apply-templates select="$bugs[id = $id]/node()" 263 <xsl:apply-templates select="$bugs[id = $id]/node()"
258 mode="work-task"> 264 mode="work-task">
259 <xsl:with-param name="indent" select="$indent" /> 265 <xsl:with-param name="indent" select="$indent" />
260 </xsl:apply-templates> 266 </xsl:apply-templates>
261 </xsl:template> 267 </xsl:template>
268
269 <xsl:template match="bug[@estimated > 0 and @complete]" mode="task-content">
270 <xsl:param name="indent" select="0" />
271 <xsl:variable name="id" select="@id" />
272
273 <!-- DEBUG -->
274 <xsl:call-template name="comment">
275 <xsl:with-param name="indent" select="$indent" />
276 <xsl:with-param name="comment" select="'work'" />
277 </xsl:call-template>
278
279 <xsl:apply-templates select="$bugs[id = $id]/node()"
280 mode="done-work-task">
281 <xsl:with-param name="indent" select="$indent" />
282 </xsl:apply-templates>
283 </xsl:template>
262 284
263 <!-- a milestone task --> 285 <!-- a milestone task -->
264 <xsl:template match="bug" mode="task-content"> 286 <xsl:template match="bug" mode="task-content">
265 <xsl:param name="indent" select="0" /> 287 <xsl:param name="indent" select="0" />
266 <xsl:variable name="id" select="@id" /> 288 <xsl:variable name="id" select="@id" />
339 <xsl:with-param name="indent" select="$indent" /> 361 <xsl:with-param name="indent" select="$indent" />
340 <xsl:with-param name="text" select="concat('effort ', .,'h')" /> 362 <xsl:with-param name="text" select="concat('effort ', .,'h')" />
341 </xsl:call-template> 363 </xsl:call-template>
342 </xsl:template> 364 </xsl:template>
343 365
344 <!-- time reports -->
345 <xsl:template match="time/report" mode="work-task">
346 <xsl:param name="indent" />
347 <xsl:variable name="email" select="string(who)" />
348 <xsl:variable name="start" select="start" />
349 <xsl:variable name="work_time" select="work_time" />
350 <xsl:variable name="resource" select="$resources[@email = $email]/@id" />
351 <xsl:call-template name="println">
352 <xsl:with-param name="indent" select="$indent" />
353 <xsl:with-param name="text"
354 select="concat('booking ', $resource, ' ', $start, ' +', $work_time,'h { overtime 2 }')" />
355 </xsl:call-template>
356 </xsl:template>
357
358 <xsl:template match="*" mode="work-task"> 366 <xsl:template match="*" mode="work-task">
359 <xsl:param name="indent" select="0" /> 367 <xsl:param name="indent" select="0" />
360 <xsl:apply-templates mode="work-task"> 368 <xsl:apply-templates mode="work-task">
361 <xsl:with-param name="indent" select="$indent" /> 369 <xsl:with-param name="indent" select="$indent" />
362 </xsl:apply-templates> 370 </xsl:apply-templates>
363 </xsl:template> 371 </xsl:template>
364 372
365 <xsl:template match="text()" mode="work-task"> 373 <xsl:template match="text()" mode="work-task">
366 </xsl:template> 374 </xsl:template>
375
376 <!-- done-work-task -->
377
378 <xsl:template match="assigned_to" mode="done-work-task">
379 <xsl:param name="indent" />
380 <xsl:variable name="email" select="string(.)" />
381 <xsl:variable name="resource" select="$resources[@email = $email]/@id" />
382 <xsl:if test="$resource">
383 <xsl:call-template name="println">
384 <xsl:with-param name="indent" select="$indent" />
385 <xsl:with-param name="text" select="concat('allocate ', $resource)" />
386 </xsl:call-template>
387 </xsl:if>
388 </xsl:template>
389
390 <!-- if we have a timereports -->
391 <xsl:template match="time/estimated[. > 0]" mode="done-work-task">
392 <xsl:param name="indent" />
393 <xsl:call-template name="println">
394 <xsl:with-param name="indent" select="$indent" />
395 <xsl:with-param name="text" select="concat('effort ', .,'h')" />
396 </xsl:call-template>
397 </xsl:template>
398
399 <xsl:template match="last_change_time" mode="done-work-task">
400 <xsl:param name="indent" />
401 <xsl:call-template name="println">
402 <xsl:with-param name="indent" select="$indent" />
403 <xsl:with-param name="text" select="concat('end ', .)" />
404 </xsl:call-template>
405 </xsl:template>
406
407 <xsl:template match="*" mode="done-work-task">
408 <xsl:param name="indent" select="0" />
409 <xsl:apply-templates mode="work-task">
410 <xsl:with-param name="indent" select="$indent" />
411 </xsl:apply-templates>
412 </xsl:template>
413
414 <xsl:template match="text()" mode="done-work-task">
415 </xsl:template>
367 416
368 <!-- milestone-task --> 417 <!-- milestone-task -->
369 <xsl:template match="assigned_to" mode="milestone-task"> 418 <xsl:template match="assigned_to" mode="milestone-task">
370 <xsl:param name="indent" /> 419 <xsl:param name="indent" />
371 <xsl:variable name="email" select="string(.)" /> 420 <xsl:variable name="email" select="string(.)" />
385 <xsl:with-param name="indent" select="$indent" /> 434 <xsl:with-param name="indent" select="$indent" />
386 </xsl:apply-templates> 435 </xsl:apply-templates>
387 </xsl:template> 436 </xsl:template>
388 437
389 <xsl:template match="text()" mode="milestone-task"> 438 <xsl:template match="text()" mode="milestone-task">
439 </xsl:template>
440
441 <!-- TIMESHEETS -->
442
443 <xsl:template match="timesheet">
444 <xsl:param name="indent" select="0" />
445 <xsl:variable name="email" select="string(@resource)" />
446 <xsl:variable name="resource" select="$resources[@email = $email]/@id" />
447
448 <xsl:call-template name="println">
449 <xsl:with-param name="indent" select="$indent" />
450 <xsl:with-param name="text"
451 select="concat('timesheet ', $resource, ' ', @start, ' - ', @end, ' {')" />
452 </xsl:call-template>
453
454 <xsl:apply-templates mode="timesheet">
455 <xsl:with-param name="indent" select="$indent + 1" />
456 </xsl:apply-templates>
457
458 <xsl:call-template name="println">
459 <xsl:with-param name="indent" select="$indent" />
460 <xsl:with-param name="text" select="'}'" />
461 </xsl:call-template>
462 </xsl:template>
463
464 <xsl:template match="bug" mode="timesheet">
465 <xsl:param name="indent" select="0" />
466 <xsl:variable name="id" select="@id" />
467
468 <xsl:call-template name="begin-line">
469 <xsl:with-param name="indent" select="$indent" />
470 </xsl:call-template>
471 <xsl:text>task </xsl:text>
472 <xsl:for-each
473 select="exsl:node-set( $parents)/bug[@id = $id]/parent/@id | @id">
474 <xsl:call-template name="bug-local-name">
475 <xsl:with-param name="id" select="." />
476 </xsl:call-template>
477 <xsl:if test="position() != last()">
478 <xsl:text>.</xsl:text>
479 </xsl:if>
480 </xsl:for-each>
481 <xsl:text> {</xsl:text>
482 <xsl:call-template name="end-line" />
483
484 <xsl:apply-templates mode="timesheet">
485 <xsl:with-param name="indent" select="$indent + 1" />
486 </xsl:apply-templates>
487
488 <xsl:call-template name="println">
489 <xsl:with-param name="indent" select="$indent" />
490 <xsl:with-param name="text" select="'}'" />
491 </xsl:call-template>
492
493 </xsl:template>
494
495 <xsl:template match="work" mode="timesheet">
496 <xsl:param name="indent" select="0" />
497
498 <xsl:call-template name="println">
499 <xsl:with-param name="indent" select="$indent" />
500 <xsl:with-param name="text" select="concat('work ', ., 'h')" />
501 </xsl:call-template>
502 </xsl:template>
503
504 <xsl:template match="remaining" mode="timesheet">
505 <xsl:param name="indent" select="0" />
506
507 <xsl:call-template name="println">
508 <xsl:with-param name="indent" select="$indent" />
509 <xsl:with-param name="text" select="concat('remaining ', ., 'h')" />
510 </xsl:call-template>
511 </xsl:template>
512
513 <xsl:template match="*" mode="timesheet">
514 <xsl:param name="indent" select="0" />
515 <xsl:apply-templates mode="milestone-task">
516 <xsl:with-param name="indent" select="$indent" />
517 </xsl:apply-templates>
518 </xsl:template>
519
520 <xsl:template match="text()" mode="timesheet">
390 </xsl:template> 521 </xsl:template>
391 522
392 <!-- PRIMITIVES --> 523 <!-- PRIMITIVES -->
393 524
394 <xsl:template name="bug-local-name"> 525 <xsl:template name="bug-local-name">