diff 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
line wrap: on
line diff
--- a/bug-list.xsl	Mon Sep 07 19:18:21 2015 +0300
+++ b/bug-list.xsl	Sun Sep 13 19:37:16 2015 +0300
@@ -116,6 +116,7 @@
 			<xsl:attribute name="desc"><xsl:value-of select="summary" /></xsl:attribute>
 			<xsl:attribute name="estimated"><xsl:value-of
 				select="number((time/estimated | estimated_time)[1])" /></xsl:attribute>
+            <xsl:attribute name="complete"><xsl:value-of select="status = 'RESOLVED' or status = 'VERIFIED'"/></xsl:attribute>
 
 			<xsl:if test="$children">
 				<xsl:attribute name="group"><xsl:value-of select="boolean($children)" /></xsl:attribute>
@@ -140,10 +141,15 @@
 
 	<!-- output -->
 	<xsl:template match="/">
-		<xsl:apply-templates select="exsl:node-set($structure)/bug">
+		<xsl:apply-templates select="exsl:node-set($structure)/node()">
 			<xsl:with-param name="indent" select="0" />
 			<xsl:with-param name="chargeset" select="$chargeset" />
 		</xsl:apply-templates>
+		<!-- 
+		<xsl:apply-templates select="bugzilla/timesheet">
+			<xsl:with-param name="indent" select="0" />
+		</xsl:apply-templates>
+		 -->
 	</xsl:template>
 
 	<!-- task -->
@@ -259,6 +265,22 @@
 			<xsl:with-param name="indent" select="$indent" />
 		</xsl:apply-templates>
 	</xsl:template>
+	
+	<xsl:template match="bug[@estimated > 0 and @complete]" mode="task-content">
+        <xsl:param name="indent" select="0" />
+        <xsl:variable name="id" select="@id" />
+
+        <!-- DEBUG -->
+        <xsl:call-template name="comment">
+            <xsl:with-param name="indent" select="$indent" />
+            <xsl:with-param name="comment" select="'work'" />
+        </xsl:call-template>
+
+        <xsl:apply-templates select="$bugs[id = $id]/node()"
+            mode="done-work-task">
+            <xsl:with-param name="indent" select="$indent" />
+        </xsl:apply-templates>
+    </xsl:template>
 
 	<!-- a milestone task -->
 	<xsl:template match="bug" mode="task-content">
@@ -341,20 +363,6 @@
 		</xsl:call-template>
 	</xsl:template>
 
-	<!-- time reports -->
-	<xsl:template match="time/report" mode="work-task">
-		<xsl:param name="indent" />
-		<xsl:variable name="email" select="string(who)" />
-		<xsl:variable name="start" select="start" />
-		<xsl:variable name="work_time" select="work_time" />
-		<xsl:variable name="resource" select="$resources[@email = $email]/@id" />
-		<xsl:call-template name="println">
-			<xsl:with-param name="indent" select="$indent" />
-			<xsl:with-param name="text"
-				select="concat('booking ', $resource, ' ', $start, ' +', $work_time,'h { overtime 2 }')" />
-		</xsl:call-template>
-	</xsl:template>
-
 	<xsl:template match="*" mode="work-task">
 		<xsl:param name="indent" select="0" />
 		<xsl:apply-templates mode="work-task">
@@ -364,6 +372,47 @@
 
 	<xsl:template match="text()" mode="work-task">
 	</xsl:template>
+	
+	<!-- done-work-task -->
+	
+	<xsl:template match="assigned_to" mode="done-work-task">
+        <xsl:param name="indent" />
+        <xsl:variable name="email" select="string(.)" />
+        <xsl:variable name="resource" select="$resources[@email = $email]/@id" />
+        <xsl:if test="$resource">
+            <xsl:call-template name="println">
+                <xsl:with-param name="indent" select="$indent" />
+                <xsl:with-param name="text" select="concat('allocate ', $resource)" />
+            </xsl:call-template>
+        </xsl:if>
+    </xsl:template>
+
+    <!-- if we have a timereports -->
+    <xsl:template match="time/estimated[. > 0]" mode="done-work-task">
+        <xsl:param name="indent" />
+        <xsl:call-template name="println">
+            <xsl:with-param name="indent" select="$indent" />
+            <xsl:with-param name="text" select="concat('effort ', .,'h')" />
+        </xsl:call-template>
+    </xsl:template>
+    
+    <xsl:template match="last_change_time" mode="done-work-task">
+        <xsl:param name="indent" />
+        <xsl:call-template name="println">
+            <xsl:with-param name="indent" select="$indent" />
+            <xsl:with-param name="text" select="concat('end ', .)" />
+        </xsl:call-template>
+    </xsl:template>
+
+    <xsl:template match="*" mode="done-work-task">
+        <xsl:param name="indent" select="0" />
+        <xsl:apply-templates mode="work-task">
+            <xsl:with-param name="indent" select="$indent" />
+        </xsl:apply-templates>
+    </xsl:template>
+
+    <xsl:template match="text()" mode="done-work-task">
+    </xsl:template>
 
 	<!-- milestone-task -->
 	<xsl:template match="assigned_to" mode="milestone-task">
@@ -389,6 +438,88 @@
 	<xsl:template match="text()" mode="milestone-task">
 	</xsl:template>
 
+	<!-- TIMESHEETS -->
+
+	<xsl:template match="timesheet">
+		<xsl:param name="indent" select="0" />
+		<xsl:variable name="email" select="string(@resource)" />
+		<xsl:variable name="resource" select="$resources[@email = $email]/@id" />
+
+		<xsl:call-template name="println">
+			<xsl:with-param name="indent" select="$indent" />
+			<xsl:with-param name="text"
+				select="concat('timesheet ', $resource, ' ', @start, ' - ', @end, ' {')" />
+		</xsl:call-template>
+
+		<xsl:apply-templates mode="timesheet">
+			<xsl:with-param name="indent" select="$indent + 1" />
+		</xsl:apply-templates>
+
+		<xsl:call-template name="println">
+			<xsl:with-param name="indent" select="$indent" />
+			<xsl:with-param name="text" select="'}'" />
+		</xsl:call-template>
+	</xsl:template>
+
+	<xsl:template match="bug" mode="timesheet">
+		<xsl:param name="indent" select="0" />
+		<xsl:variable name="id" select="@id" />
+
+		<xsl:call-template name="begin-line">
+			<xsl:with-param name="indent" select="$indent" />
+		</xsl:call-template>
+		<xsl:text>task </xsl:text>
+		<xsl:for-each
+			select="exsl:node-set( $parents)/bug[@id = $id]/parent/@id | @id">
+			<xsl:call-template name="bug-local-name">
+				<xsl:with-param name="id" select="." />
+			</xsl:call-template>
+			<xsl:if test="position() != last()">
+				<xsl:text>.</xsl:text>
+			</xsl:if>
+		</xsl:for-each>
+		<xsl:text> {</xsl:text>
+		<xsl:call-template name="end-line" />
+
+		<xsl:apply-templates mode="timesheet">
+			<xsl:with-param name="indent" select="$indent + 1" />
+		</xsl:apply-templates>
+
+		<xsl:call-template name="println">
+			<xsl:with-param name="indent" select="$indent" />
+			<xsl:with-param name="text" select="'}'" />
+		</xsl:call-template>
+
+	</xsl:template>
+
+	<xsl:template match="work" mode="timesheet">
+		<xsl:param name="indent" select="0" />
+
+		<xsl:call-template name="println">
+			<xsl:with-param name="indent" select="$indent" />
+			<xsl:with-param name="text" select="concat('work ', ., 'h')" />
+		</xsl:call-template>
+	</xsl:template>
+
+	<xsl:template match="remaining" mode="timesheet">
+		<xsl:param name="indent" select="0" />
+
+		<xsl:call-template name="println">
+			<xsl:with-param name="indent" select="$indent" />
+			<xsl:with-param name="text" select="concat('remaining ', ., 'h')" />
+		</xsl:call-template>
+	</xsl:template>
+
+	<xsl:template match="*" mode="timesheet">
+		<xsl:param name="indent" select="0" />
+		<xsl:apply-templates mode="milestone-task">
+			<xsl:with-param name="indent" select="$indent" />
+		</xsl:apply-templates>
+	</xsl:template>
+
+	<xsl:template match="text()" mode="timesheet">
+	</xsl:template>
+
 	<!-- PRIMITIVES -->
 
 	<xsl:template name="bug-local-name">