A$unik

From ICO wiki
Revision as of 19:00, 10 June 2017 by Jtrink (talk | contribs) (→‎XSLT 2)
Jump to navigationJump to search

Meeskonna liikmed

  • Hardi Antsov
  • Juhan Trink

Rakenduse info

Lähtekoodi leiab: https://github.com/hantsov/asunik

Rakendus jookseb ka Azure's. Rakendus läheb Azure's "sleep mode", kui seda ei kasutata mõnd aega. Seega esimene laadimine võib võtta ca 15 sekundit.

Klientrakendus:
http://asunikng.azurewebsites.net

Teenus:
http://apiasunik.azurewebsites.net/api


Logi

  • 17.03 - Meeskonna Wiki lehe loomine, esialgne arutelu teema kohta
  • 28.05 - Valmis teenus ja rakendus, vaja täita veel aine wiki nõuded.

XML ülesanded

XML

<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet href="asunik_games_1.xsl" type="text/xsl"?>
<games xmlns="http://wwww.asunik.ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://wwww.asunik.ee asunik_games.xsd">
    <game>
        <name>Witcher 3</name>
        <developer>CD Projekt RED</developer>
        <publisher>CD Projekt</publisher>
        <genre>Action role-playing</genre>
        <release>2015-05-19</release>
        <platforms>
            <platform>Microsoft Windows</platform>
            <platform>PlayStation 4</platform>
            <platform>Xbox One</platform>
        </platforms>
        <reviews>
            <review type="critic">
                <author>Phill Cameron</author>
                <publisher>Telegraph</publisher>
                <score max="5">5</score>
                <summary>
                    There is no saving the world, here, no great evil force pervading the landscape, or a doomsday clock
                    ticking down to inevitable destruction, with only you to stand in its way.
                    The story of Wild Hunt is a personal one, set in a huge and unrelentingly beautiful world.
                </summary>
                <address>www.telegraph.co.uk/gaming/what-to-play/witcher-3-wild-hunt-review/</address>
            </review>
            <review type="critic">
                <author>Vince Ingenito</author>
                <publisher>IGN</publisher>
                <score max="10">9.3</score>
                <summary>
                    Though the straightforward and fetch-quest-heavy main story overstays its welcome, the option
                    of joyfully adventuring through a rich, expansive open world was always there for me when I’d start
                    to burn out. Even if the plot isn’t terribly interesting, the many characters who play a part in it
                    are, and along with the excellent combat and RPG gameplay, they elevate The Witcher 3 to a plane few
                    other RPGs inhabit.
                </summary>
                <address>www.ign.com/articles/2015/05/12/the-witcher-3-the-wild-hunt-review</address>
            </review>
            <review type="user">
                <author>Hardi Antsov</author>
                <score max="100">99</score>
                <summary>
                    Clap, clap, clap, CD Projekt Red.
                </summary>
                <address>www.123reviews.com/witcher3/reviews/100</address>
            </review>
        </reviews>
        <offers>
            <offer limitedtime="true">
                <name>Steam</name>
                <address>store.steampowered.com/app/292030/</address>
                <amount currency="EUR">17.99</amount>
            </offer>
            <offer>
                <name>GOG</name>
                <address>www.gog.com/game/the_witcher_3_wild_hunt</address>
                <amount currency="EUR">37.79</amount>
            </offer>
        </offers>
    </game>
    <game>
        <name>XCOM 2</name>
        <developer>Firaxis Games</developer>
        <publisher>2K Games</publisher>
        <genre>Turn-based tactics</genre>
        <release>2016-02-05</release>
        <platforms>
            <platform>Microsoft Windows</platform>
            <platform>Linux</platform>
            <platform>OS X</platform>
            <platform>PlayStation 4</platform>
            <platform>Xbox One</platform>
        </platforms>
        <reviews>
            <review type="critic">
                <author>Mike Mahardy</author>
                <publisher>Gamespot</publisher>
                <score max="10">9</score>
                <summary>
                    Now that XCOM 2 has made its way to consoles, these sentiments remain the same. Some technical
                    issues have migrated from this year’s PC release: characters sometimes freeze in place while the
                    turn progresses; soldiers can take almost 10 seconds to execute commands; and cutscenes have a
                    tendency to drop frame rates throughout campaigns. But the layered tactics, impactful meta-game, and
                    deep character-building are all intact on PS4 and Xbox One. XCOM 2 remains a superb strategy title.
                </summary>
                <address>www.gamespot.com/reviews/xcom-2-review/1900-6416347/</address>
            </review>
            <review type="user">
                <author>Juhan Trink</author>
                <score max="100">85</score>
                <summary>
                    Better graphics and some gameplay improvements but buggy and not optimized very well.
                </summary>
                <address>www.123reviews.com/xcom2/reviews/3</address>
            </review>
        </reviews>
        <offers>
            <offer limitedtime="true">
                <name>Humble Store</name>
                <address>www.humblebundle.com/store/xcom-2</address>
                <amount currency="EUR">49.99</amount>
            </offer>
            <offer>
                <name>Amazon</name>
                <address>www.amazon.com/XCOM-2-PC/dp/B00YHZEILQ?th=1</address>
                <amount currency="USD">24.99</amount>
            </offer>
        </offers>
    </game>
</games>

XSD

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"
           targetNamespace="http://wwww.asunik.ee" xmlns="http://wwww.asunik.ee">

    <!--General element types and enums-->
    <xs:simpleType name="userType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="critic"/>
            <xs:enumeration value="user"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="currencyType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="EUR"/>
            <xs:enumeration value="USD"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="nameType">
        <xs:restriction base="xs:string">
            <xs:maxLength value="250"/>
        </xs:restriction>
    </xs:simpleType>
    <xs:simpleType name="addressType">
        <xs:restriction base="xs:anyURI">
            <xs:maxLength value="500"/>
        </xs:restriction>
    </xs:simpleType>

    <!--Main structure types-->
    <xs:element name="games" type="gamesType"/>
    <xs:complexType name="amountType">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute type="currencyType" name="currency" use="required"/>
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>
    <xs:complexType name="offerType">
        <xs:sequence>
            <xs:element name="name" type="nameType"/>
            <xs:element name="address" type="addressType"/>
            <xs:element type="amountType" name="amount"/>
        </xs:sequence>
        <xs:attribute type="xs:boolean" name="limitedtime" use="optional"/>
    </xs:complexType>
    <xs:complexType name="gameType">
        <xs:sequence>
            <xs:element name="name" type="nameType"/>
            <xs:element name="developer" type="nameType"/>
            <xs:element name="publisher" type="nameType"/>
            <xs:element name="genre">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:enumeration value="Action role-playing"/>
                        <xs:enumeration value="Turn-based tactics"/>
                        <xs:enumeration value="Other available genres..."/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:element>
            <xs:element name="release" type="xs:date"/>
            <xs:element type="platformsType" name="platforms"/>
            <xs:element type="reviewsType" name="reviews"/>
            <xs:element type="offersType" name="offers"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="platformsType">
        <xs:sequence>
            <xs:element name="platform" maxOccurs="30" minOccurs="1">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:enumeration value="Microsoft Windows"/>
                        <xs:enumeration value="PlayStation 4"/>
                        <xs:enumeration value="Xbox One"/>
                        <xs:enumeration value="Linux"/>
                        <xs:enumeration value="OS X"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="scoreType">
        <xs:simpleContent>
            <xs:extension base="xs:float">
                <xs:attribute type="xs:float" name="max" use="required"/>
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>
    <xs:complexType name="reviewType">
        <xs:sequence>
            <xs:element name="author" type="xs:string"/>
            <xs:element name="publisher" minOccurs="0" type="xs:string"/>
            <xs:element type="scoreType" name="score"/>
            <xs:element name="summary">
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:maxLength value="1000"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:element>
            <xs:element name="address" type="addressType"/>
        </xs:sequence>
        <xs:attribute type="userType" name="type" use="optional"/>
    </xs:complexType>
    <xs:complexType name="gamesType">
        <xs:sequence>
            <xs:element type="gameType" name="game" maxOccurs="unbounded" minOccurs="0"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="reviewsType">
        <xs:sequence>
            <xs:element type="reviewType" name="review" maxOccurs="unbounded" minOccurs="0"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="offersType">
        <xs:sequence>
            <xs:element type="offerType" name="offer" maxOccurs="unbounded" minOccurs="0"/>
        </xs:sequence>
    </xs:complexType>
</xs:schema>


XSLT 1

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:asunik="http://wwww.asunik.ee">
    <xsl:template match="/">
        <html>
            <head>
            </head>
            <body>
                <xsl:for-each select="asunik:games/asunik:game">
                    <h2>
                        <xsl:value-of select="asunik:name"/>
                    </h2>
                    <table border="1">
                        <tr>
                            <th colspan="3">Critic reviews</th>
                        </tr>
                        <tr>
                            <th>Reviewer</th>
                            <th>Score</th>
                            <th>Max</th>
                        </tr>

                        <xsl:for-each select="asunik:reviews/asunik:review">
                            <xsl:if test="@type='critic'">
                                <tr>
                                    <td>
                                        <xsl:value-of select="asunik:author"/><xsl:text> </xsl:text><xsl:value-of select="asunik:publisher"/>
                                    </td>
                                    <td>
                                        <xsl:value-of select="asunik:score"/>
                                    </td>
                                    <td>
                                        <xsl:value-of select="asunik:score/@max"/>
                                    </td>
                                </tr>
                            </xsl:if>
                        </xsl:for-each>
                        <tr>
                            <th colspan="3">User reviews</th>
                        </tr>
                        <xsl:for-each select="asunik:reviews/asunik:review">
                            <xsl:if test="@type='user'">
                                <tr>
                                    <td>
                                        <xsl:value-of select="asunik:author"/><xsl:text> </xsl:text><xsl:value-of select="asunik:publisher"/>
                                    </td>
                                    <td>
                                        <xsl:value-of select="asunik:score"/>
                                    </td>
                                    <td>
                                        <xsl:value-of select="asunik:score/@max"/>
                                    </td>
                                </tr>
                            </xsl:if>
                        </xsl:for-each>
                    </table>
                </xsl:for-each>
            </body>
        </html>
    </xsl:template>
</xsl:stylesheet>

XSLT 2: TODO Juhan

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:asunik="http://wwww.asunik.ee">
    <xsl:template match="/">
        <games>
            <xsl:for-each select="asunik:games/asunik:game">
                <game>
                    <id>
                        <xsl:value-of select="position()"/>
                    </id>
                    <title>
                        <xsl:value-of select="asunik:name"/>
                    </title>
                    <percentScores>
                        <xsl:for-each select="asunik:reviews/asunik:review">
                            <percentScore>
                                <xsl:variable name="maxScore">
                                    <xsl:value-of select="asunik:score/@max"/>
                                </xsl:variable>
                                <xsl:value-of select="asunik:score div $maxScore * 100"/>
                            </percentScore>
                        </xsl:for-each>
                    </percentScores>
                </game>
            </xsl:for-each>
        </games>
    </xsl:template>
</xsl:stylesheet>

Veebiteenuse analüüs

Klientrakenduse analüüs

Retsensioonid