Skip to content

Commit

Permalink
#109 show summary
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Aug 16, 2024
1 parent 634e9f7 commit 41d56db
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 13 deletions.
10 changes: 9 additions & 1 deletion tests/simple.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,18 @@
ev: 4373.5
pv: 7484.2
-
_id: 17
_id: 18
start: 2024-03-17T22:22:22.8492Z
when: 2024-05-17T22:22:22.8492Z
what: earned-value-prev
ac: 654
ev: 5373.5
pv: 8484.2
-
_id: 19
start: 2024-03-17T22:22:22.8492Z
when: 2024-05-17T22:22:22.8492Z
what: earned-value
ac: 654
ev: 5373.5
pv: 8484.2
24 changes: 12 additions & 12 deletions xsl/awards.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,19 @@ SOFTWARE.
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:choose>
<xsl:when test="$a = 0">
<xsl:text>—</xsl:text>
</xsl:when>
<xsl:when test="$a &gt; 0">
<xsl:text>+</xsl:text>
<xsl:value-of select="$a"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$a"/>
</xsl:otherwise>
</xsl:choose>
</span>
<xsl:choose>
<xsl:when test="$a = 0">
<xsl:text>—</xsl:text>
</xsl:when>
<xsl:when test="$a &gt; 0">
<xsl:text>+</xsl:text>
<xsl:value-of select="$a"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$a"/>
</xsl:otherwise>
</xsl:choose>
</xsl:function>
<xsl:function name="z:td-award">
<xsl:param name="a"/>
Expand Down
41 changes: 41 additions & 0 deletions xsl/index.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,31 @@ SOFTWARE.
<xsl:import href="policy.xsl"/>
<xsl:import href="qo-section.xsl"/>
<xsl:import href="dot.xsl"/>
<xsl:function name="z:index">
<xsl:param name="i"/>
<span>
<xsl:attribute name="class">
<xsl:choose>
<xsl:when test="$i &gt;= 0">
<xsl:text>darkgreen</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>darkred</xsl:text>
</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
<xsl:variable name="v" select="format-number($i, '0.00')"/>
<xsl:choose>
<xsl:when test="$i &gt;= 0">
<xsl:text>+</xsl:text>
<xsl:value-of select="$v"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$v"/>
</xsl:otherwise>
</xsl:choose>
</span>
</xsl:function>
<xsl:function name="z:pmp">
<xsl:param name="fb"/>
<xsl:param name="area"/>
Expand Down Expand Up @@ -133,6 +158,9 @@ SOFTWARE.
<xsl:with-param name="what" select="'earned-value-prev'"/>
<xsl:with-param name="title" select="'Earned Value Analysis (EVA)'"/>
<xsl:with-param name="colors" select="'n_spi:#1c448e,n_cpi:#b8336a'"/>
<xsl:with-param name="before">
<xsl:apply-templates select="/fb/f[what='earned-value'][last()]"/>
</xsl:with-param>
</xsl:call-template>
<xsl:apply-templates select="/" mode="dot"/>
</article>
Expand Down Expand Up @@ -224,4 +252,17 @@ SOFTWARE.
</body>
</html>
</xsl:template>
<xsl:template match="f[what='earned-value']">
<xsl:text>AC: </xsl:text>
<xsl:value-of select="format-number(ac, '0')"/>
<xsl:text>, EV: </xsl:text>
<xsl:value-of select="format-number(ev, '0')"/>
<xsl:text>, PV: </xsl:text>
<xsl:value-of select="format-number(pv, '0')"/>
<xsl:text>, CPI: </xsl:text>
<xsl:copy-of select="z:index(ev div ac)"/>
<xsl:text>, SPI: </xsl:text>
<xsl:copy-of select="z:index(ev div pv)"/>
<xsl:text>.</xsl:text>
</xsl:template>
</xsl:stylesheet>
6 changes: 6 additions & 0 deletions xsl/qo-section.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ SOFTWARE.
<xsl:param name="what" as="xs:string"/>
<xsl:param name="title" as="xs:string"/>
<xsl:param name="colors" as="xs:string" select="'n_composite:orange'"/>
<xsl:param name="before"/>
<xsl:variable name="facts" select="/fb/f[what=$what and xs:dateTime(when) &gt; (xs:dateTime($today) - xs:dayTimeDuration('P180D'))]"/>
<xsl:choose>
<xsl:when test="empty($facts)">
Expand All @@ -40,6 +41,11 @@ SOFTWARE.
<h2>
<xsl:value-of select="$title"/>
</h2>
<xsl:if test="not(empty($before))">
<p>
<xsl:copy-of select="$before"/>
</p>
</xsl:if>
<div class="qo-section">
<canvas id="{$what}">
<xsl:text> </xsl:text>
Expand Down

0 comments on commit 41d56db

Please sign in to comment.