Enhanced statistics

This commit is contained in:
Papick Garcia Taboada committed 2015-06-17 16:30:36 +02:00
1 parent 31a8ed08ea
commit 55562ff323
8 files changed
+139 -11

No files matched your search

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Ebene_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 32 30" enable-background="new 0 0 32 30" xml:space="preserve">
<g>
<g>
<g>
<path fill-rule="evenodd" clip-rule="evenodd" fill="#008ECB" d="M5.9,23.9l1.6,2.8h20l3.4-4.2L5.9,23.9z M12.5,21.3L25.1,20
c0,0-0.9-4.6-3.7-7.8c-3.4-3.9-10.4-9.1-10.4-9.1s3,7.2,3,11.5C13.9,18.1,12.5,21.3,12.5,21.3z"/>
</g>
</g>
<path fill="#008ECB" d="M7,9H2C1.5,9,1,8.6,1,8s0.4-1,1-1h5c0.6,0,1,0.4,1,1S7.6,9,7,9z"/>
<path fill="#008ECB" d="M9,14H4c-0.6,0-1-0.4-1-1s0.4-1,1-1h5c0.6,0,1,0.4,1,1S9.6,14,9,14z"/>
<path fill="#008ECB" d="M8,19H3c-0.6,0-1-0.4-1-1s0.4-1,1-1h5c0.6,0,1,0.4,1,1S8.6,19,8,19z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 979 B

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.4, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Ebene_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="841.889px" height="595.281px" viewBox="0 0 841.889 595.281" enable-background="new 0 0 841.889 595.281"
xml:space="preserve">
<g>
<g>
<g>
<g>
<path fill="#008ECB" d="M289.695,245.788c1.984,0,1.984,0,3.97,0c5.952,1.984,9.921,9.921,7.937,15.874
c-15.874,47.623-3.969,101.198,29.766,134.932c35.717,35.717,87.308,47.622,134.929,31.748
c5.953-1.984,13.891,1.983,15.875,7.938c1.983,5.952-1.984,13.891-7.938,15.874c-55.559,19.843-119.056,5.952-160.725-37.701
c-41.67-41.67-55.56-105.166-35.717-162.71C279.773,249.757,283.742,245.788,289.695,245.788z"/>
<path fill="#008ECB" d="M331.365,259.677c1.983,0,1.983,0,3.969,0c5.953,1.983,9.922,9.922,7.938,15.873
c-11.905,31.75-3.969,67.467,19.843,91.276c23.812,23.812,57.544,31.749,89.292,19.844c5.951-1.984,13.89,1.983,15.873,7.938
c1.984,5.952-1.983,13.89-7.938,15.874c-41.668,13.89-85.323,3.969-117.071-25.796c-29.764-29.764-41.67-75.401-25.796-117.071
C321.443,263.646,325.412,259.677,331.365,259.677z"/>
<path fill="#008ECB" d="M371.05,275.552c1.984,0,1.984,0,3.969,0c5.953,1.983,9.922,9.922,7.938,15.873
c-5.953,15.876-1.984,33.733,9.921,45.64c11.906,11.905,29.765,15.874,45.638,9.921c5.954-1.982,13.891,1.984,15.875,7.938
c1.981,5.953-1.984,13.89-7.938,15.874c-25.795,7.938-51.591,1.983-71.434-15.874c-17.857-17.858-25.795-47.622-15.874-71.435
C361.129,277.536,367.082,275.552,371.05,275.552z"/>
</g>
</g>
</g>
<path fill="#008ECB" d="M390.892,166.417c41.67-41.669,130.962-49.605,180.567,0c49.607,49.606,41.671,136.915,0,180.568
L390.892,166.417z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Ebene_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 30 30" enable-background="new 0 0 30 30" xml:space="preserve">
<path fill="#008ECB" d="M13.3,13H6.4c-0.5,0-0.9-0.5-0.9-1s0.4-1,0.9-1h6.9c1.3,0,2.5-1.2,2.5-2.6s-1.1-2.6-2.5-2.6
c-1.3,0-2.5,1.2-2.5,2.6c0,0.5-0.4,0.9-0.9,0.9c-0.5,0-0.9-0.4-0.9-0.9c0-2.4,1.9-4.4,4.3-4.4c2.3,0,4.3,2.1,4.3,4.5
S15.7,13,13.3,13z M27.3,11.5c0-2.4-2-4.5-4.3-4.5c-2.4,0-4.3,2-4.3,4.4c0,0.5,0.4,0.9,0.9,0.9c0.5,0,0.9-0.4,0.9-0.9
c0-1.4,1.1-2.6,2.4-2.6c1.3,0,2.5,1.2,2.5,2.6c0,1.4-1.2,2.6-2.5,2.6H3.4c-0.5,0-0.9,0.5-0.9,1s0.4,1,0.9,1H23
C25.3,16,27.3,13.9,27.3,11.5z M22.7,21.2c0-2.3-1.9-4.2-4.3-4.2H6.4c-0.5,0-0.9,0.5-0.9,1s0.4,1,0.9,1h11.9c1.4,0,2.5,0.9,2.5,2.2
c0,1.3-1,2.2-2.5,2.2c-1.4,0-2.5-1-2.5-2.3c0-0.5-0.4-0.9-0.9-0.9s-0.9,0.4-0.9,0.9c0,2.3,1.9,4.1,4.3,4.1
C20.8,25.3,22.7,23.5,22.7,21.2z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 18.1.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Ebene_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 30 30" enable-background="new 0 0 30 30" xml:space="preserve">
<g>
<path fill="#008ECB" d="M9.3,23.7v-1.9l4.9-7.2L9.4,8.1V6.3h10.8v3h-5.9l3.9,5.3l-4.2,6.1h6.7v3H9.3z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 556 B

@@ -12,26 +12,35 @@ import com.sap.sailing.gwt.ui.shared.dispatch.event.EventStatisticsDTO;
public class StatisticsBox extends Composite implements RefreshableWidget<EventStatisticsDTO> {
private static final StringMessages MSG = StringMessages.INSTANCE;
public static final String ICON_REGATTAS_FOUGHT = "images/mobile/icon_regattasFought.svg";
public static final String ICON_COMPATITORS_COUNT = "images/mobile/icon_averageSpeed.svg";
public static final String ICON_RACES_COUNT = "images/mobile/icon_racesCount.svg";
public static final String ICON_TRACKED_COUNT = "images/mobile/icon_trackedCount.svg";
public static final String ICON_FASTEST_SAILOR = "images/mobile/fastest_sailor.svg";
public static final String ICON_RAW_GPS_FIX = "images/mobile/raw_gps_fixes.svg";
public static final String ICON_STRONGEST_WIND = "images/mobile/strongest_wind.svg";
public static final String ICON_SUM_MILES = "images/mobile/sum_miles.svg";
private static StatisticsBoxUiBinder uiBinder = GWT.create(StatisticsBoxUiBinder.class);
interface StatisticsBoxUiBinder extends UiBinder<Widget, StatisticsBox> {
}
@UiField MobileSection itemContainerUi;
@UiField
MobileSection itemContainerUi;
public StatisticsBox() {
StatisticsBoxResources.INSTANCE.css().ensureInjected();
initWidget(uiBinder.createAndBindUi(this));
}
public void addItem(String iconUrl, String name, Integer count) {
itemContainerUi.addContent(new StatisticsBoxItem(iconUrl, name, count));
public void addItem(String iconUrl, String name, Object payload) {
itemContainerUi.addContent(new StatisticsBoxItem(iconUrl, name, payload));
}
public void addItemIfNotNull(String iconUrl, String name, Object payload) {
if (payload != null) {
itemContainerUi.addContent(new StatisticsBoxItem(iconUrl, name, payload));
}
}
@Override
@@ -41,6 +50,10 @@ public class StatisticsBox extends Composite implements RefreshableWidget<EventS
addItem(StatisticsBox.ICON_COMPATITORS_COUNT, MSG.competitors(), statistics.getCompetitorsCount());
addItem(StatisticsBox.ICON_RACES_COUNT, MSG.races(), statistics.getRacesRunCount());
addItem(StatisticsBox.ICON_TRACKED_COUNT, MSG.trackedRaces(), statistics.getTrackedRacesCount());
addItemIfNotNull(StatisticsBox.ICON_RAW_GPS_FIX, MSG.rawGPSFixes(), statistics.getRawGPSFixes());
addItemIfNotNull(StatisticsBox.ICON_FASTEST_SAILOR,
MSG.fastestSailor() + ": " + statistics.getFastestSailorInfo(), statistics.getFastestSailorSpeed());
addItemIfNotNull(StatisticsBox.ICON_STRONGEST_WIND, MSG.strongestWind(), statistics.getStrongestWind());
addItemIfNotNull(StatisticsBox.ICON_SUM_MILES, MSG.sailedMiles(), statistics.getSumSailedMiles());
}
}
@@ -19,11 +19,11 @@ class StatisticsBoxItem extends Widget {
@UiField SpanElement nameUi;
@UiField SpanElement valueUi;
public StatisticsBoxItem(String iconUrl, String name, Integer value) {
public StatisticsBoxItem(String iconUrl, String name, Object payload) {
setElement(uiBinder.createAndBindUi(this));
iconUi.setSrc(iconUrl);
nameUi.setInnerText(name);
valueUi.setInnerText(value == null ? "n/a" : String.valueOf(value));
valueUi.setInnerText(payload == null ? "n/a" : String.valueOf(payload));
}
}
@@ -8,6 +8,11 @@ public class EventStatisticsDTO implements DTO {
private Integer competitorsCount;
private Integer racesRunCount;
private Integer trackedRacesCount;
private Integer rawGPSFixes;
private Integer sumSailedMiles;
private Integer fastestSailorSpeed;
private String fastestSailorInfo;
private String strongestWind;
@SuppressWarnings("unused")
private EventStatisticsDTO() {
@@ -56,4 +61,43 @@ public class EventStatisticsDTO implements DTO {
this.trackedRacesCount = trackedRacesCount;
}
public Integer getRawGPSFixes() {
return rawGPSFixes;
}
public void setRawGPSFixes(Integer rawGPSFixes) {
this.rawGPSFixes = rawGPSFixes;
}
public Integer getSumSailedMiles() {
return sumSailedMiles;
}
public void setSumSailedMiles(Integer sumSailedMiles) {
this.sumSailedMiles = sumSailedMiles;
}
public Integer getFastestSailorSpeed() {
return fastestSailorSpeed;
}
public void setFastestSailorSpeed(Integer fastestSailorSpeed) {
this.fastestSailorSpeed = fastestSailorSpeed;
}
public String getFastestSailorInfo() {
return fastestSailorInfo;
}
public void setFastestSailorInfo(String fastestSailorInfo) {
this.fastestSailorInfo = fastestSailorInfo;
}
public String getStrongestWind() {
return strongestWind;
}
public void setStrongestWind(String strongestWind) {
this.strongestWind = strongestWind;
}
}
@@ -43,6 +43,9 @@ public class GetEventStatisticsAction implements Action<ResultWithTTL<EventStati
}
}
return new ResultWithTTL<EventStatisticsDTO>(1000 * 60 * 5, new EventStatisticsDTO(regattas, competitors, races, trackedRaces));
EventStatisticsDTO statisticsDTO = new EventStatisticsDTO(regattas, competitors, races, trackedRaces);
// TODO: add more stats to DTO
return new ResultWithTTL<EventStatisticsDTO>(1000 * 60 * 5, statisticsDTO);
}
}