Skip to content

Commit

Permalink
#109 show graph
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Aug 16, 2024
1 parent aa46b1c commit 634e9f7
Show file tree
Hide file tree
Showing 5 changed files with 123 additions and 2 deletions.
56 changes: 56 additions & 0 deletions judges/index-eva/add-indexes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# MIT License
#
# Copyright (c) 2024 Zerocracy
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
---
options:
testing: true
input:
-
start: 2024-04-17T22:22:22.8492Z
when: 2024-05-17T22:22:22.8492Z
what: earned-value-prev
ac: 433
ev: 4342.42
pv: 6540.56
-
start: 2024-04-17T22:22:22.8492Z
when: 2024-05-17T22:22:22.8492Z
what: earned-value-prev
ev: 4342.42
pv: 6540.56
-
start: 2024-04-17T22:22:22.8492Z
when: 2024-05-17T22:22:22.8492Z
what: earned-value-prev
ac: 433
ev: 0.0
pv: 6540.56
-
start: 2024-04-17T22:22:22.8492Z
when: 2024-05-17T22:22:22.8492Z
what: earned-value-prev
ac: 433
ev: 437
pv: 0
expected:
- /fb[count(f)=4]
- /fb/f[n_spi]
- /fb/f[n_cpi]
40 changes: 40 additions & 0 deletions judges/index-eva/index-eva.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# frozen_string_literal: true

# MIT License
#
# Copyright (c) 2024 Zerocracy
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

require 'fbe/fb'

Fbe.fb.query("
(and
(eq what 'earned-value-prev')
(exists when)
(exists start)
(exists ac)
(not (eq ac 0))
(exists pv)
(not (eq pv 0))
(exists ev))
").each do |f|
f.n_cpi = f.ev / f.ac
f.n_spi = f.ev / f.pv
end
16 changes: 16 additions & 0 deletions tests/simple.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,19 @@
awarded: 220
payout: 120
balance: 20
-
_id: 17
start: 2024-04-17T22:22:22.8492Z
when: 2024-05-17T22:22:22.8492Z
what: earned-value-prev
ac: 433
ev: 4373.5
pv: 7484.2
-
_id: 17
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
5 changes: 5 additions & 0 deletions xsl/index.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ SOFTWARE.
<xsl:with-param name="what" select="'quantity-of-deliverables'"/>
<xsl:with-param name="title" select="'Quantity of Deliverables (QoD)'"/>
</xsl:call-template>
<xsl:call-template name="qo-section">
<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:call-template>
<xsl:apply-templates select="/" mode="dot"/>
</article>
<footer>
Expand Down
8 changes: 6 additions & 2 deletions xsl/qo-section.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ SOFTWARE.
<xsl:template name="qo-section">
<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: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 Down Expand Up @@ -67,9 +68,12 @@ SOFTWARE.
<xsl:text>{label:'</xsl:text>
<xsl:value-of select="substring-after($n, 'n_')"/>
<xsl:text>',borderColor:</xsl:text>
<xsl:variable name='c' select="substring-before(substring-after(concat(',', $colors, ','), concat(',', $n, ':')), ',')"/>
<xsl:choose>
<xsl:when test="$n = 'n_composite'">
<xsl:text>'orange'</xsl:text>
<xsl:when test="$c">
<xsl:text>'</xsl:text>
<xsl:value-of select="$c"/>
<xsl:text>'</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>color.darken(</xsl:text>
Expand Down

0 comments on commit 634e9f7

Please sign in to comment.