178 changed files with 10493 additions and 0 deletions
@ -0,0 +1,26 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<classpath> |
|||
<classpathentry kind="src" output="target/classes" path="src"> |
|||
<attributes> |
|||
<attribute name="optional" value="true"/> |
|||
<attribute name="maven.pomderived" value="true"/> |
|||
</attributes> |
|||
</classpathentry> |
|||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-9"> |
|||
<attributes> |
|||
<attribute name="maven.pomderived" value="true"/> |
|||
</attributes> |
|||
</classpathentry> |
|||
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v9.0"> |
|||
<attributes> |
|||
<attribute name="owner.project.facets" value="jst.web"/> |
|||
</attributes> |
|||
</classpathentry> |
|||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> |
|||
<attributes> |
|||
<attribute name="maven.pomderived" value="true"/> |
|||
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/> |
|||
</attributes> |
|||
</classpathentry> |
|||
<classpathentry kind="output" path="target/classes"/> |
|||
</classpath> |
|||
@ -0,0 +1,37 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<projectDescription> |
|||
<name>Final</name> |
|||
<comment></comment> |
|||
<projects> |
|||
</projects> |
|||
<buildSpec> |
|||
<buildCommand> |
|||
<name>org.eclipse.jdt.core.javabuilder</name> |
|||
<arguments> |
|||
</arguments> |
|||
</buildCommand> |
|||
<buildCommand> |
|||
<name>org.eclipse.wst.common.project.facet.core.builder</name> |
|||
<arguments> |
|||
</arguments> |
|||
</buildCommand> |
|||
<buildCommand> |
|||
<name>org.eclipse.wst.validation.validationbuilder</name> |
|||
<arguments> |
|||
</arguments> |
|||
</buildCommand> |
|||
<buildCommand> |
|||
<name>org.eclipse.m2e.core.maven2Builder</name> |
|||
<arguments> |
|||
</arguments> |
|||
</buildCommand> |
|||
</buildSpec> |
|||
<natures> |
|||
<nature>org.eclipse.m2e.core.maven2Nature</nature> |
|||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature> |
|||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature> |
|||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature> |
|||
<nature>org.eclipse.jdt.core.javanature</nature> |
|||
<nature>org.eclipse.wst.jsdt.core.jsNature</nature> |
|||
</natures> |
|||
</projectDescription> |
|||
@ -0,0 +1,12 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<classpath> |
|||
<classpathentry excluding="**/bower_components/*|**/node_modules/*|**/*.min.js" kind="src" path="WebContent"/> |
|||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/> |
|||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject"> |
|||
<attributes> |
|||
<attribute name="hide" value="true"/> |
|||
</attributes> |
|||
</classpathentry> |
|||
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/> |
|||
<classpathentry kind="output" path=""/> |
|||
</classpath> |
|||
@ -0,0 +1,8 @@ |
|||
eclipse.preferences.version=1 |
|||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled |
|||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=9 |
|||
org.eclipse.jdt.core.compiler.compliance=9 |
|||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error |
|||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error |
|||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning |
|||
org.eclipse.jdt.core.compiler.source=9 |
|||
@ -0,0 +1,4 @@ |
|||
activeProfiles= |
|||
eclipse.preferences.version=1 |
|||
resolveWorkspaceProjects=true |
|||
version=1 |
|||
@ -0,0 +1,9 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0"> |
|||
<wb-module deploy-name="Final-0.0.1-SNAPSHOT"> |
|||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/> |
|||
<wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/> |
|||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/> |
|||
<property name="context-root" value="Final"/> |
|||
<property name="java-output-path" value="/Final/build/classes"/> |
|||
</wb-module> |
|||
</project-modules> |
|||
@ -0,0 +1,10 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<faceted-project> |
|||
<runtime name="Apache Tomcat v9.0"/> |
|||
<fixed facet="jst.web"/> |
|||
<fixed facet="java"/> |
|||
<fixed facet="wst.jsdt.web"/> |
|||
<installed facet="java" version="9"/> |
|||
<installed facet="wst.jsdt.web" version="1.0"/> |
|||
<installed facet="jst.web" version="3.1"/> |
|||
</faceted-project> |
|||
@ -0,0 +1 @@ |
|||
org.eclipse.wst.jsdt.launching.baseBrowserLibrary |
|||
@ -0,0 +1 @@ |
|||
Window |
|||
@ -0,0 +1,2 @@ |
|||
disabled=06target |
|||
eclipse.preferences.version=1 |
|||
@ -0,0 +1,508 @@ |
|||
@charset "ISO-8859-1"; |
|||
|
|||
|
|||
.wrapper { |
|||
display: grid; |
|||
grid-template-columns: repeat(16, [col-start] 1fr); |
|||
grid-gap: 10px; |
|||
} |
|||
.wrapper > * { |
|||
grid-column: col-start / span 16; |
|||
} |
|||
.main-nav { |
|||
background: #f1f1f1; |
|||
-webkit-box-shadow: 0 10px 5px #888888; |
|||
-moz-box-shadow: 0 10px 5px #888888; |
|||
box-shadow: 0 10px 5px #888888; |
|||
} |
|||
.main-footer { |
|||
background: #ff8306; |
|||
} |
|||
|
|||
.main-head { |
|||
background: #ff8306; |
|||
} |
|||
|
|||
.cn { |
|||
display: flex; |
|||
justify-content: center; |
|||
align-items: center; |
|||
height:100%; |
|||
} |
|||
|
|||
@media (min-width: 500px) { |
|||
|
|||
.side { |
|||
grid-column: col-start / span 3; |
|||
grid-row: 3; |
|||
} |
|||
.ad { |
|||
grid-column: col-start / span 3; |
|||
grid-row: 4; |
|||
} |
|||
.content, .main-footer { |
|||
grid-column: col-start 4 / span 9; |
|||
} |
|||
nav ul { |
|||
display: flex; |
|||
justify-content: space-between; |
|||
} |
|||
} |
|||
|
|||
@media (min-width: 700px) { |
|||
|
|||
.main-head { |
|||
grid-column: col-start / span 16; |
|||
grid-row: 1; |
|||
} |
|||
.main-nav { |
|||
grid-column: col-start / span 2; |
|||
grid-row: 2 / 4; |
|||
} |
|||
|
|||
.graph { |
|||
grid-column: col-start 1 / span 16; |
|||
grid-row: 2; |
|||
} |
|||
|
|||
.team { |
|||
grid-column: col-start 1 / span 3; |
|||
grid-row: 2; |
|||
|
|||
} |
|||
.side { |
|||
grid-column: col-start 15 / span 2; |
|||
grid-row: 2; |
|||
} |
|||
.ad { |
|||
grid-column: col-start 15 / span 2; |
|||
grid-row: 3; |
|||
} |
|||
.main-footer { |
|||
grid-column: col-start / span 16; |
|||
} |
|||
nav ul { |
|||
flex-direction: column; |
|||
} |
|||
|
|||
.listing { |
|||
list-style: none; |
|||
display: grid; |
|||
grid-gap: 10px; |
|||
grid-auto-flow: dense; |
|||
grid-template-columns: repeat(auto-fill,minmax(350px, 1fr)); |
|||
padding:10px; |
|||
padding-top:0px; |
|||
margin:0px; |
|||
} |
|||
.listing li { |
|||
border: 1px solid #ffe066; |
|||
border-radius: 5px; |
|||
display: flex; |
|||
flex-direction: column; |
|||
background:#ffffff; |
|||
} |
|||
.listing .wide { |
|||
grid-column-end: span 2; |
|||
} |
|||
.listing .superwide { |
|||
grid-column-end: span 3; |
|||
} |
|||
|
|||
.listingTeam { |
|||
list-style: none; |
|||
display: grid; |
|||
grid-gap: 10px; |
|||
grid-auto-flow: dense; |
|||
grid-template-columns: repeat(auto-fill,minmax(500px, 600px)); |
|||
padding:10px; |
|||
padding-top:0px; |
|||
margin:0px; |
|||
flex-direction: row; |
|||
} |
|||
.listingTeam li { |
|||
border: 1px solid #ffe066; |
|||
border-radius: 5px; |
|||
display: flex; |
|||
flex-direction: column; |
|||
background:#ffffff; |
|||
} |
|||
.listingTeam .wide { |
|||
grid-column-end: span 2; |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
body { |
|||
background: #ff8306; |
|||
color: #444; |
|||
font: 100%/20px 'Helvetica Neue', helvetica, arial, sans-serif; |
|||
text-shadow: 0 1px 0 #974b00; |
|||
-moz-user-select: -moz-none; |
|||
-webkit-user-select: none; |
|||
-khtml-user-select: none; |
|||
-o-user-select: none; |
|||
user-select: none; |
|||
} |
|||
.cadre |
|||
{ |
|||
background: #000051; |
|||
border: 5px solid #fff; |
|||
display: inline-block; |
|||
max-width: 100%; |
|||
padding-bottom: 10px; |
|||
} |
|||
|
|||
.HeaderDiv |
|||
{ |
|||
background: linear-gradient(#777, #444); |
|||
color: #fff; |
|||
text-shadow: 0 1px 0 #000; |
|||
font-size: 12px ; |
|||
font-weight: bold; |
|||
} |
|||
|
|||
.tableTrade { |
|||
background: #000051; |
|||
border-collapse: collapse; |
|||
font-size: 9px; |
|||
text-shadow: 0 1px 0 #ffffff; |
|||
line-height: 12px; |
|||
-ms-user-select:none; |
|||
width:100%; |
|||
|
|||
} |
|||
|
|||
.tableTrade > thead > tr > th |
|||
{ |
|||
border-right: 1px solid #fff; |
|||
border-left: 1px solid #e8e8e8; |
|||
font-weight: bold; |
|||
padding: 2px 1px; |
|||
position: relative; |
|||
text-shadow: 0 1px 0 #000; |
|||
font-size: 9px ; |
|||
|
|||
-ms-user-select:none; |
|||
} |
|||
|
|||
.tableTrade > thead > tr > th:first-child |
|||
{ |
|||
border-left: 0px solid ; |
|||
} |
|||
.tableTrade > thead > tr > th:last-child |
|||
{ |
|||
border-right: 0px solid ; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
.tableTrade > thead > tr.Header > th |
|||
{ |
|||
background: linear-gradient(#777, #444); |
|||
color: #fff; |
|||
text-align:center; |
|||
} |
|||
|
|||
.tableTrade > thead > tr.Header > th.focus { |
|||
background: linear-gradient(#959595, #d4d4d4); |
|||
cursor: pointer; |
|||
} |
|||
|
|||
.tableTrade > tbody > tr.ligneHead > th |
|||
{ |
|||
padding: 2px 3px; |
|||
border-right: 1px solid #fff; |
|||
border-left: 1px solid #e8e8e8; |
|||
background: linear-gradient(#c0c0c0, #efefef); |
|||
color: #2b2b2b; |
|||
text-align:center; |
|||
} |
|||
.tableTrade > tbody > tr.ligneHead > th:first-child |
|||
{ |
|||
border-left: 0px solid ; |
|||
} |
|||
.tableTrade > tbody > tr.ligneHead > th:last-child |
|||
{ |
|||
border-right: 0px solid ; |
|||
} |
|||
|
|||
.tableTrade > tbody > tr > th.positive |
|||
{ |
|||
background: linear-gradient(#91ff91, #d5ffd5); |
|||
color: #004000; |
|||
} |
|||
.tableTrade > tbody > tr > th.negative |
|||
{ |
|||
background: linear-gradient(#ff8c8c, #ffd5d5); |
|||
color: #710000; |
|||
} |
|||
.tableTrade > tbody > tr > th.neutral |
|||
{ |
|||
background: linear-gradient(#ffdab5, #ffeedd); |
|||
color: #ff8306; |
|||
} |
|||
.tableTrade > tbody > tr.tab:nth-child(odd) > td.positive |
|||
{ |
|||
background: linear-gradient(#91ff91, #d5ffd5); |
|||
color: #004000; |
|||
} |
|||
.tableTrade > tbody > tr.tab:nth-child(odd) > td.negative |
|||
{ |
|||
background: linear-gradient(#ff8c8c, #ffd5d5); |
|||
color: #710000; |
|||
} |
|||
.tableTrade > tbody > tr.tab:nth-child(odd) > td.neutral |
|||
{ |
|||
background: linear-gradient(#ffdab5, #ffeedd); |
|||
color: #ff8306; |
|||
} |
|||
.tableTrade > tbody > tr.tab:nth-child(even) > td.positive |
|||
{ |
|||
background: linear-gradient(#91ff91, #d5ffd5); |
|||
color: #004000; |
|||
} |
|||
.tableTrade > tbody > tr.tab:nth-child(even) > td.negative |
|||
{ |
|||
background: linear-gradient(#ff8c8c, #ffd5d5); |
|||
color: #710000; |
|||
} |
|||
.tableTrade > tbody > tr.tab:nth-child(even) > td.neutral |
|||
{ |
|||
background: linear-gradient(#ffdab5, #ffeedd); |
|||
color: #ff8306; |
|||
} |
|||
|
|||
.tableTrade > tbody > tr.tab > td:hover { |
|||
background: linear-gradient(#c9c9c9, #eeeeee); |
|||
transition: all 300ms; |
|||
} |
|||
|
|||
.tableTrade > tbody > tr > td |
|||
{ |
|||
font-size: 9px ; |
|||
border-right: 1px solid #fff; |
|||
border-left: 1px solid #e8e8e8; |
|||
padding: 2px 1px; |
|||
position: relative; |
|||
transition: all 300ms; |
|||
text-align:center; |
|||
-ms-user-select:none; |
|||
} |
|||
.tableTrade > tbody > tr > td:first-child |
|||
{ |
|||
border-left: 0px solid ; |
|||
} |
|||
.tableTrade > tbody > tr > td:last-child |
|||
{ |
|||
border-right: 0px solid ; |
|||
} |
|||
|
|||
.tableTrade > tbody > tr.freeAgentInjured > td { |
|||
background: linear-gradient(#c0c0c0, #e6e6e6); |
|||
} |
|||
|
|||
.tableTrade > tbody > tr.tab:nth-child(odd) > td |
|||
{ |
|||
background: linear-gradient(#f3f3f3, #fafafa); |
|||
color: #2b2b2b; |
|||
} |
|||
.tableTrade > tbody > tr.tab:nth-child(even) > td |
|||
{ |
|||
background: linear-gradient(#f3f3f3, #ffffff); |
|||
color: #2b2b2b; |
|||
} |
|||
|
|||
.tableTrade > tbody > tr.tab:hover > td |
|||
{ |
|||
background: #8cffff; |
|||
cursor: pointer; |
|||
} |
|||
|
|||
|
|||
.tableTrade > tbody > tr:nth-child(odd).displayed > td |
|||
{ |
|||
background: linear-gradient(#26bf73, #7ae4af); |
|||
} |
|||
.tableTrade > tbody > tr:nth-child(even).displayed > td |
|||
{ |
|||
background: linear-gradient(#48db92, #a5edc9); |
|||
} |
|||
.tableTrade > tbody > tr:nth-child(odd).selected > td |
|||
{ |
|||
background-color: #9FAFD1; |
|||
} |
|||
.tableTrade > tbody > tr:nth-child(even).selected > td |
|||
{ |
|||
background-color: #B0BED9; |
|||
} |
|||
|
|||
|
|||
.tableTrade > tbody > tr.tab:nth-child(odd) > td |
|||
{ |
|||
background: linear-gradient(#f3f3f3, #fafafa); |
|||
color: #2b2b2b; |
|||
} |
|||
.tableTrade > tbody > tr.tab:nth-child(even) > td |
|||
{ |
|||
background: linear-gradient(#f3f3f3, #ffffff); |
|||
color: #2b2b2b; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
.tableTrade > tbody > tr.hidden |
|||
{ |
|||
display: none; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
strong { |
|||
font-weight: bold; |
|||
} |
|||
|
|||
em { |
|||
font-style: italic; |
|||
} |
|||
|
|||
|
|||
|
|||
.asc:after {content: "\25B2"; } |
|||
.desc:after {content: "\25BC"; } |
|||
|
|||
.focus { |
|||
background-color: #ff00ff; |
|||
color: #fff; |
|||
cursor: pointer; |
|||
font-weight: bold; |
|||
} |
|||
.selected { |
|||
background-color: #ff00ff; |
|||
color: #fff; |
|||
font-weight: bold; |
|||
} |
|||
|
|||
|
|||
#myInput { |
|||
background-image: url('../PICS/searchicon.png'); /* Add a search icon to input */ |
|||
background-position: 5px 6px; /* Position the search icon */ |
|||
background-repeat: no-repeat; /* Do not repeat the icon image */ |
|||
width: 100%; /* Full-width */ |
|||
font-size: 14px; /* Increase font-size */ |
|||
padding: 6px 10px 6px 40px; /* Add some padding */ |
|||
border: 1px solid #ddd; /* Add a grey border */ |
|||
margin-bottom: 6px; /* Add some space below the input */ |
|||
margin-top: 6px; /* Add some space below the input */ |
|||
} |
|||
|
|||
.positive |
|||
{ |
|||
background: linear-gradient(#91ff91, #d5ffd5); |
|||
color: #004000; |
|||
|
|||
} |
|||
.negative |
|||
{ |
|||
background: linear-gradient(#ff8c8c, #ffd5d5); |
|||
color: #710000; |
|||
} |
|||
.neutral |
|||
{ |
|||
background: linear-gradient(#ff9d3c, #ffc78e); |
|||
color: #ff8040; |
|||
} |
|||
|
|||
#everything-wrapper { |
|||
display : none; |
|||
} |
|||
|
|||
|
|||
span { |
|||
display: block; |
|||
margin: 0 auto; |
|||
} |
|||
|
|||
span[class*="l-"] { |
|||
height: 4px; width: 4px; |
|||
background: #000; |
|||
display: inline-block; |
|||
margin: 12px 2px; |
|||
|
|||
border-radius: 100%; |
|||
-webkit-border-radius: 100%; |
|||
-moz-border-radius: 100%; |
|||
|
|||
-webkit-animation: loader 4s infinite; |
|||
-webkit-animation-timing-function: cubic-bezier(0.030, 0.615, 0.995, 0.415); |
|||
-webkit-animation-fill-mode: both; |
|||
-moz-animation: loader 4s infinite; |
|||
-moz-animation-timing-function: cubic-bezier(0.030, 0.615, 0.995, 0.415); |
|||
-moz-animation-fill-mode: both; |
|||
-ms-animation: loader 4s infinite; |
|||
-ms-animation-timing-function: cubic-bezier(0.030, 0.615, 0.995, 0.415); |
|||
-ms-animation-fill-mode: both; |
|||
animation: loader 4s infinite; |
|||
animation-timing-function: cubic-bezier(0.030, 0.615, 0.995, 0.415); |
|||
animation-fill-mode: both; |
|||
} |
|||
|
|||
span.l-1 {-webkit-animation-delay: 1s;animation-delay: 1s;-ms-animation-delay: 1s;-moz-animation-delay: 1s;} |
|||
span.l-2 {-webkit-animation-delay: 0.8s;animation-delay: 0.8s;-ms-animation-delay: 0.8s;-moz-animation-delay: 0.8s;} |
|||
span.l-3 {-webkit-animation-delay: 0.6s;animation-delay: 0.6s;-ms-animation-delay: 0.6s;-moz-animation-delay: 0.6s;} |
|||
span.l-4 {-webkit-animation-delay: 0.4s;animation-delay: 0.4s;-ms-animation-delay: 0.4s;-moz-animation-delay: 0.4s;} |
|||
span.l-5 {-webkit-animation-delay: 0.2s;animation-delay: 0.2s;-ms-animation-delay: 0.2s;-moz-animation-delay: 0.2s;} |
|||
span.l-6 {-webkit-animation-delay: 0;animation-delay: 0;-ms-animation-delay: 0;-moz-animation-delay: 0;} |
|||
|
|||
@-webkit-keyframes loader { |
|||
0% {-webkit-transform: translateX(-30px); opacity: 0;} |
|||
25% {opacity: 1;} |
|||
50% {-webkit-transform: translateX(30px); opacity: 0;} |
|||
100% {opacity: 0;} |
|||
} |
|||
|
|||
@-moz-keyframes loader { |
|||
0% {-moz-transform: translateX(-30px); opacity: 0;} |
|||
25% {opacity: 1;} |
|||
50% {-moz-transform: translateX(30px); opacity: 0;} |
|||
100% {opacity: 0;} |
|||
} |
|||
|
|||
@-keyframes loader { |
|||
0% {-transform: translateX(-30px); opacity: 0;} |
|||
25% {opacity: 1;} |
|||
50% {-transform: translateX(30px); opacity: 0;} |
|||
100% {opacity: 0;} |
|||
} |
|||
|
|||
@-ms-keyframes loader { |
|||
0% {-ms-transform: translateX(-30px); opacity: 0;} |
|||
25% {opacity: 1;} |
|||
50% {-ms-transform: translateX(30px); opacity: 0;} |
|||
100% {opacity: 0;} |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
dfs{ |
|||
color: #f0f0f0; |
|||
} |
|||
|
|||
select { |
|||
font-size:16px; |
|||
cursor: pointer; |
|||
background: linear-gradient(#ffe6cc, #ffffff); |
|||
width :100%; |
|||
} |
|||
|
|||
|
|||
@ -0,0 +1,273 @@ |
|||
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" |
|||
pageEncoding="ISO-8859-1"%> |
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
|||
<link href="${pageContext.request.contextPath}/CSS/style.css" rel="stylesheet" type="text/css" > |
|||
|
|||
<title>team</title> |
|||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> |
|||
<%@ taglib uri = "http://java.sun.com/jsp/jstl/functions" prefix = "fn" %> |
|||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> |
|||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> |
|||
<script> |
|||
$(document).ready(function() { |
|||
|
|||
var ln = '${team1Stats.size()}'; |
|||
//color other team points |
|||
var tradeProjSel = $("td[name='tradeProjSel']"); |
|||
var actualProj = $("[name='actualProj']"); |
|||
var cat = $("[name='cat']"); |
|||
var z = 0; |
|||
for (x=0;x<$(tradeProjSel).size();x++){ |
|||
if(z==$(cat).size()){z=0;} |
|||
if($(cat).eq(z).text() == "RK-P"){ |
|||
var n = ""+(parseFloat($(tradeProjSel).eq(x).text()) - parseFloat($(actualProj).eq(z).text())); |
|||
if(n>0){ |
|||
$(tradeProjSel).eq(x).addClass("positive"); |
|||
$(tradeProjSel).eq(x-1).addClass("positive"); |
|||
}else if(n==0){ |
|||
$(tradeProjSel).eq(x).addClass("neutral"); |
|||
$(tradeProjSel).eq(x-1).addClass("neutral"); |
|||
}else{ |
|||
$(tradeProjSel).eq(x).addClass("negative"); |
|||
$(tradeProjSel).eq(x-1).addClass("negative"); |
|||
} |
|||
} |
|||
if(z > ln+2){ |
|||
var n = ""+(parseFloat($(tradeProjSel).eq(x).text()) - parseFloat($(actualProj).eq(z).text())); |
|||
if(n>0){ |
|||
$(tradeProjSel).eq(x).addClass("positive"); |
|||
}else if(n==0){ |
|||
$(tradeProjSel).eq(x).addClass("neutral"); |
|||
}else{ |
|||
$(tradeProjSel).eq(x).addClass("negative"); |
|||
} |
|||
} |
|||
z+=1; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
var sort = $("[title='filter']"); |
|||
$(sort).each(function(col) { |
|||
$(this).hover( |
|||
function() { $(this).addClass('focus'); }, |
|||
function() { $(this).removeClass('focus'); } |
|||
); |
|||
|
|||
if($(this).text()=="RK-P"){ |
|||
$(this).addClass('desc selected'); |
|||
}; |
|||
|
|||
$(this).click(function() { |
|||
if ($(this).is('.desc')) { |
|||
$(this).removeClass('desc'); |
|||
$(this).addClass('asc selected'); |
|||
sortOrder = 1; |
|||
} |
|||
else { |
|||
$(this).addClass('desc selected'); |
|||
$(this).removeClass('asc'); |
|||
sortOrder = -1; |
|||
} |
|||
$(this).siblings().removeClass('asc selected'); |
|||
$(this).siblings().removeClass('desc selected'); |
|||
|
|||
var arrData = $('table').find("tr[name='lignesResults']"); |
|||
/* var arrData = $('table').find('tbody:nth-of-type(2) > tr').get(); */ |
|||
|
|||
arrData.sort(function(a, b) { |
|||
var val1 = $(a).children('td').eq(col).text().replace("+","").toUpperCase(); |
|||
var val2 = $(b).children('td').eq(col).text().replace("+","").toUpperCase(); |
|||
if($.isNumeric(val1) && $.isNumeric(val2)) |
|||
return sortOrder == 1 ? val1-val2 : val2-val1; |
|||
else |
|||
return (val1 < val2) ? -sortOrder : (val1 > val2) ? sortOrder : 0; |
|||
}); |
|||
|
|||
|
|||
$.each(arrData, function(index, row) { |
|||
$('tbody:nth-of-type(3)').append(row); |
|||
}); |
|||
}); |
|||
}); |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
</script> |
|||
|
|||
</head> |
|||
<body> |
|||
|
|||
|
|||
<c:set var="mainFA" value="${requestScope.mainFA}" /> |
|||
<c:set var="stats" value="${requestScope.statBase}" /> |
|||
<c:set var="team1" value="${requestScope.team1}" /> |
|||
<c:set var="team1Stats" value="${requestScope.team1Stats}" /> |
|||
<c:set var="otherTeamStats" value="${requestScope.otherTeamStats}" /> |
|||
<c:set var="nbTeam" value="${requestScope.nbTeam}" /> |
|||
|
|||
<table class="tableTrade"> |
|||
<thead> |
|||
<tr class="Header"> |
|||
<th colspan="2" ><c:out value="TEAM" /></th> |
|||
<th name="actualRK"><c:out value="Proj RK" /></th> |
|||
<th name="actualPTS"><c:out value="Proj PTS" /></th> |
|||
</tr> |
|||
</thead> |
|||
<tr class="ligneHead"> |
|||
<th colspan="2"><c:out value="${team1.name}" /></th> |
|||
<th name="actualRK"><fmt:formatNumber pattern="0.#" value="${team1.projRK}" /></th> |
|||
<th name="actualPTS"><fmt:formatNumber pattern="0.#" value="${team1.projTot}" /></th> |
|||
</tr> |
|||
|
|||
<thead> |
|||
<tr class="Header"> |
|||
<th><c:out value="Player RK" /></th> |
|||
<th align="left"><c:out value="Player" /></th> |
|||
<th ><c:out value="Pot RK" /></th> |
|||
<th ><c:out value="Pot PTS" /></th> |
|||
</tr> |
|||
|
|||
</thead> |
|||
<tbody > |
|||
<c:forEach var="player" items= "${players}" varStatus="i"> |
|||
<tr name="lignesPlayer" class="tab" id="${i.index}" onclick="return callfilterResults(this);"> |
|||
<td align="center"><fmt:formatNumber pattern="0.#" value="${player.interRK}" /></td> |
|||
<td align="left" name ="player"><c:out value="${player.nom}" /></td> |
|||
<td name="potRKcell" ><fmt:formatNumber pattern="0.#" value="${player.potRK}" /></td> |
|||
<td name="potPTScell" ><fmt:formatNumber pattern="0.#" value="${player.potPoint}" /></td> |
|||
</tr> |
|||
</c:forEach> |
|||
</tbody> |
|||
</table> |
|||
|
|||
<input type="text" id="myInput" onkeyup="filterName()" placeholder="Search for names.."> |
|||
|
|||
</div> |
|||
|
|||
<div id="fa_div" style="display: inline-block;vertical-align:top"> |
|||
|
|||
<table class="tableTrade"> |
|||
<thead > |
|||
<!---------------------- TAB HEADER-------------------------------> |
|||
<tr class="Header" > |
|||
<th name="statTab" colspan="${fn:length(team1Stats)+1}"><c:out value="Waiver impact" /></th> |
|||
<th name="teamTab" colspan="${nbTeam - 1}"><c:out value="Impact on other teams" /></th> |
|||
</tr> |
|||
<!----------------------------------------- STATS CAT ----------------> |
|||
<tr name="headers" class="Header" > |
|||
<th align="left" ><c:out value="Drop" /></th> |
|||
<th ><c:out value="Pot RK" /></th> |
|||
<c:forEach var="stat" items= "${stats}" > |
|||
<c:if test="${!fn:contains(stat.name,'/')}"> |
|||
<th ><c:out value="${fn:replace(stat.name,'Team ','')}" /></th> |
|||
</c:if> |
|||
</c:forEach> |
|||
</tr> |
|||
</thead> |
|||
<!------------------------------- LIGNE ACTUAL STATS PROJECTION--> |
|||
<tbody > |
|||
<tr name="headers" class="ligneHead" > |
|||
<c:forEach var="stat" items= "${team1Stats}" varStatus="i"> |
|||
<c:if test="${i.first}"> |
|||
<th name="actualPlayers">Actual Projection</th> |
|||
<th name="actualProj"><fmt:formatNumber pattern="0.#" value="${team1projectedRK}" /></th> |
|||
<th name="actualProj"><fmt:formatNumber pattern="0.#" value="${team1projTot}" /></th> |
|||
</c:if> |
|||
<c:if test="${!fn:contains(stat.name,'/')}"> |
|||
<th name="actualProj"><c:out value="${stat.valProjection}" /></th> |
|||
</c:if> |
|||
</c:forEach> |
|||
|
|||
<c:forEach var="stat" items= "${otherTeamStats}" > |
|||
<th name="actualProj"><c:out value="${stat}" /></th> |
|||
</c:forEach> |
|||
</tr> |
|||
|
|||
<!-- LIGNE WITH FA STATS PROJECTION--> |
|||
<tr name="headers" class="ligneHead" > |
|||
<c:forEach var="stat" items= "${stats}" varStatus="i"> |
|||
<c:if test="${stat.name == 'RK-P'}"> |
|||
<th name="tradePlayers" >Proj with FA</th> |
|||
<th name="tradeProj"><c:out value="--" /></th> |
|||
</c:if> |
|||
|
|||
<c:if test="${!stat.name.contains('/')}"> |
|||
<th name="tradeProj"><c:out value="--" /></th> |
|||
</c:if> |
|||
|
|||
</c:forEach> |
|||
</tr> |
|||
|
|||
<!------------- LIGNE DIFFERENCES -----> |
|||
<tr name="headers" class="ligneHead" > |
|||
<c:forEach var="stat" items= "${stats}" varStatus="i"> |
|||
<c:if test="${stat.name == 'RK-P'}"> |
|||
<th >Difference</th> |
|||
<th id="diff" name="diff"><c:out value="--" /></th> |
|||
</c:if> |
|||
|
|||
<c:if test="${!stat.name.contains('/')}"> |
|||
<th id="diff" name="diff"><c:out value="--" /></th> |
|||
</c:if> |
|||
|
|||
</c:forEach> |
|||
</tr> |
|||
|
|||
</tbody> |
|||
|
|||
<thead > |
|||
<!----------------------------------------- STATS CAT ----------------> |
|||
<tr name="headers" class="Header" > |
|||
<th align="left" title="filter"><c:out value="Waiver" /></th> |
|||
<th name="cat" title="filter"><c:out value="Pot RK" /></th> |
|||
<c:forEach var="stat" items= "${stats}" > |
|||
<c:if test="${!fn:contains(stat.name,'/')}"> |
|||
<th name="cat" title="filter"><c:out value="${fn:replace(stat.name,'Team ','')}" /></th> |
|||
</c:if> |
|||
</c:forEach> |
|||
</tr> |
|||
</thead> |
|||
<!------------------------ START RESULT TAB--------------------------------> |
|||
|
|||
<tbody id="tTrade" style="overflow-y: scroll;overflow-x: hidden;" > |
|||
<c:forEach var="fa" items= "${mainFA}" > |
|||
|
|||
<tr name="lignesResults" class="tab" id="${i.index}" onclick="return listDiff(this);"> |
|||
|
|||
<c:forEach var="stat" items= "${fa}" varStatus="i" > |
|||
|
|||
<c:if test="${i.first}"> |
|||
<td align="left" name="get"><c:out value="${stat.player}" /></td> |
|||
<td name="tradeProjSel"><fmt:formatNumber pattern="0.#" value="${stat.projectedRK}" /></td> |
|||
</c:if> |
|||
<c:if test="${!fn:contains(stat.name,'/')}"> |
|||
<c:if test="${!fn:contains(stat.name,'%')}"> |
|||
<td name="tradeProjSel" align="center"><fmt:formatNumber pattern="0.#" value="${stat.valProjection}" /></td> |
|||
</c:if> |
|||
<c:if test="${fn:contains(stat.name,'%')}"> |
|||
<td name="tradeProjSel" align="center"><fmt:formatNumber pattern="0.00" value="${stat.valProjection}" /></td> |
|||
</c:if> |
|||
</c:if> |
|||
|
|||
</c:forEach> |
|||
|
|||
</tr> |
|||
|
|||
</c:forEach> |
|||
</tbody> |
|||
</table> |
|||
|
|||
|
|||
|
|||
</body> |
|||
</html> |
|||
|
|||
|
|||
@ -0,0 +1,97 @@ |
|||
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" |
|||
pageEncoding="ISO-8859-1"%> |
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
|||
<link href="${pageContext.request.contextPath}/CSS/style.css" rel="stylesheet" type="text/css" > |
|||
|
|||
<title>GRAPH</title> |
|||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> |
|||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> |
|||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> |
|||
<script type="text/javascript"> |
|||
|
|||
$(document).ready(function() { |
|||
|
|||
var title = '${title}'; |
|||
var maxVal = '${maxVal}'; |
|||
var lowVal = '${lowVal}'; |
|||
var width = '${width}'; |
|||
var height = '${height}'; |
|||
var left = '${left}'; |
|||
var top = '${top}'; |
|||
var divGraph = '${divGraph}'; |
|||
var legPos = '${legPos}'; |
|||
var direc = '${direc}'; |
|||
var heightPour = '${heightPour}'; |
|||
var widthPour = '${widthPour}'; |
|||
|
|||
|
|||
function drawLineColors() { |
|||
$.ajax({ |
|||
url: 'GRAPH_CALL', |
|||
dataType: 'json', |
|||
success: function (json) { |
|||
console.log(json); |
|||
// assumes json is a DataTable-compatible JSON string |
|||
var data = new google.visualization.DataTable(json); |
|||
|
|||
console.log(data); |
|||
var options = { |
|||
title: title, |
|||
titlePosition: {'position':'top','alignment':'center'}, |
|||
|
|||
hAxis: { |
|||
//title: 'Season Days', |
|||
gridlines: {count: 0}, |
|||
|
|||
}, |
|||
|
|||
vAxis: { |
|||
//title: 'Relative Rotisserie Points', |
|||
direction: direc, |
|||
gridlines: {color: '#e3e3e2', count: 11}, |
|||
viewWindow: { |
|||
max: maxVal, |
|||
min: lowVal |
|||
} |
|||
}, |
|||
|
|||
|
|||
'width':width, |
|||
'height':height, |
|||
legend: {'position':legPos,'alignment':'center', textStyle: {fontSize: 10}}, |
|||
chartArea:{ |
|||
left:left,top:top,width:widthPour+"%",height:heightPour+"%", |
|||
/* backgroundColor: { |
|||
stroke: '#4322c0', |
|||
strokeWidth: 1 |
|||
} */ |
|||
}, |
|||
colors: ['#9b2b7a', '#FFC300', '#C70039','#d3fe04','#33ebff','#ff33ed','#0309af','#0aaf03','#fe0404','#bd5200','#037512','#acafad','#070105'] |
|||
}; |
|||
var chart = new google.visualization.LineChart(document.getElementById(divGraph)); |
|||
chart.draw(data, options); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
google.charts.load('current', {packages: ['corechart', 'line']}); |
|||
google.charts.setOnLoadCallback(drawLineColors); |
|||
|
|||
}); |
|||
|
|||
|
|||
</script> |
|||
|
|||
</head> |
|||
<body> |
|||
<c:set var="divGraphe" value="${divGraph}" /> |
|||
|
|||
<div style="text-align:center;" id="${divGraphe}"></div> |
|||
|
|||
</body> |
|||
</html> |
|||
|
|||
|
|||
@ -0,0 +1,92 @@ |
|||
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" |
|||
pageEncoding="ISO-8859-1"%> |
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
|||
<link href="${pageContext.request.contextPath}/CSS/style.css" rel="stylesheet" type="text/css" > |
|||
|
|||
<title>MaxPace</title> |
|||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> |
|||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> |
|||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> |
|||
<script type="text/javascript"> |
|||
|
|||
$(document).ready(function() { |
|||
// color impact in center columns |
|||
var pace = $("[name='pace']"); |
|||
for (x=0;x<$(pace).size();x++){ |
|||
var n = ""+(parseFloat($(pace).eq(x).text())); |
|||
if(n>0){ |
|||
$(pace).eq(x).text("+" + n); |
|||
$(pace).eq(x).removeClass("negative").addClass("positive"); |
|||
}else{ |
|||
$(pace).eq(x).removeClass("positive").addClass("negative"); |
|||
} |
|||
} |
|||
|
|||
}); |
|||
|
|||
$(window).load(function() { |
|||
|
|||
|
|||
}); //end doc ready |
|||
|
|||
|
|||
|
|||
</script> |
|||
|
|||
</head> |
|||
<body> |
|||
|
|||
<c:set var="teams" value="${requestScope.teamList}" /> |
|||
<c:set var="slots" value="${requestScope.slotList}" /> |
|||
|
|||
<table class="tableTrade"> |
|||
<thead> |
|||
<tr class="Header" style="line-height: 20px;"> |
|||
<c:forEach var="team" items= "${teams}" > |
|||
<th colspan="3"><strong><c:out value="${team.name}" /></strong></th> |
|||
</c:forEach> |
|||
</tr> |
|||
<tr class="Header" style="line-height: 20px;"> |
|||
<c:forEach var="team" items= "${teams}" varStatus="i"> |
|||
<th name="head" style="text-align:left">Slot</th> |
|||
<th name="head" style="text-align:center">Played</th> |
|||
<th name="head">Pace</th> |
|||
|
|||
</c:forEach> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
|
|||
<c:forEach var="slot" items= "${slotList}" varStatus="i"> |
|||
|
|||
<c:if test="${i.index < 8}"> |
|||
|
|||
<tr name="ligne" class="tab"> |
|||
|
|||
<c:forEach var="team" items= "${teams}" > |
|||
|
|||
<td style="text-align:left;"><strong><c:out value="${team.slots[i.index].nomPos}" /></strong></td> |
|||
|
|||
<td align="center"><c:out value="${team.slots[i.index].gamesPlayed}" /></td> |
|||
<td name="pace" align="center"><fmt:formatNumber pattern="0.#" value="${team.slots[i.index].pace}" /></td> |
|||
|
|||
</c:forEach> |
|||
|
|||
</tr> |
|||
|
|||
</c:if> |
|||
|
|||
</c:forEach> |
|||
|
|||
</tbody> |
|||
</table> |
|||
|
|||
|
|||
|
|||
</body> |
|||
</html> |
|||
|
|||
|
|||
@ -0,0 +1,182 @@ |
|||
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" |
|||
pageEncoding="ISO-8859-1"%> |
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
|||
<link href="${pageContext.request.contextPath}/CSS/style.css" rel="stylesheet" type="text/css" > |
|||
|
|||
<title>League Teams</title> |
|||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> |
|||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> |
|||
<script src="${pageContext.request.contextPath}/WEB-INF/lib/jquery.rowselector.min.js"></script> |
|||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> |
|||
<script type="text/javascript"> |
|||
|
|||
$(document).ready(function() { |
|||
$("#${tableName} > tbody > tr").each(function() { |
|||
if($(this).attr("teamid") != '${teamID}') |
|||
{ |
|||
this.className='hidden'; |
|||
} |
|||
}); |
|||
|
|||
}); |
|||
|
|||
$(window).load(function() { |
|||
|
|||
var cellP = $("td[name='player']"); |
|||
var nbPlayer = '${Tplayers.size()}'; |
|||
var tmp = generateColor('#ffd157','#ff0000',nbTeam/2); |
|||
var tmp2 = generateColor('#00d700','#d6fa05',nbTeam/2); |
|||
$.merge(tmp,tmp2); |
|||
var z = 0; |
|||
$(cellP).each(function() { |
|||
for(x=0;x<nbPlayer;x++){ |
|||
if($(cellP).eq(z).text() < nbTeam - x +0.5 && $(cellP).eq(z).text() >= nbTeam - x -0.5){ |
|||
$(this).css('background', 'linear-gradient(#'+tmp[x] + ', #' +tmp[x] + ')'); |
|||
} |
|||
} |
|||
z+=1; |
|||
}); |
|||
|
|||
function hex (c) { |
|||
var s = "0123456789abcdef"; |
|||
var i = parseInt (c); |
|||
if (i == 0 || isNaN (c)) |
|||
return "00"; |
|||
i = Math.round (Math.min (Math.max (0, i), 255)); |
|||
return s.charAt ((i - i % 16) / 16) + s.charAt (i % 16); |
|||
} |
|||
|
|||
/* Convert an RGB triplet to a hex string */ |
|||
function convertToHex (rgb) { |
|||
return hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]); |
|||
} |
|||
|
|||
/* Remove '#' in color hex string */ |
|||
function trim (s) { return (s.charAt(0) == '#') ? s.substring(1, 7) : s } |
|||
|
|||
/* Convert a hex string to an RGB triplet */ |
|||
function convertToRGB (hex) { |
|||
var color = []; |
|||
color[0] = parseInt ((trim(hex)).substring (0, 2), 16); |
|||
color[1] = parseInt ((trim(hex)).substring (2, 4), 16); |
|||
color[2] = parseInt ((trim(hex)).substring (4, 6), 16); |
|||
return color; |
|||
} |
|||
|
|||
function generateColor(colorStart,colorEnd,colorCount){ |
|||
// The beginning of your gradient |
|||
var start = convertToRGB (colorStart); |
|||
// The end of your gradient |
|||
var end = convertToRGB (colorEnd); |
|||
// The number of colors to compute |
|||
var len = colorCount; |
|||
//Alpha blending amount |
|||
var alpha = 0.0; |
|||
var saida = []; |
|||
for (i = 0; i < len; i++) { |
|||
var c = []; |
|||
alpha += (1.0/len); |
|||
|
|||
c[0] = start[0] * alpha + (1 - alpha) * end[0]; |
|||
c[1] = start[1] * alpha + (1 - alpha) * end[1]; |
|||
c[2] = start[2] * alpha + (1 - alpha) * end[2]; |
|||
|
|||
saida.push(convertToHex (c)); |
|||
} |
|||
return saida; |
|||
} |
|||
}); //end doc ready |
|||
|
|||
|
|||
function RowClick(currenttr,table, otherTable) { |
|||
|
|||
$("#" + table +" > tbody > tr").each(function() { |
|||
var tableRow = this; |
|||
|
|||
if($(tableRow).attr("id") == $(currenttr).attr("id")) |
|||
{ |
|||
|
|||
if($(tableRow).attr("teamid") != $(tableRow).attr("tid")){ |
|||
tableRow.className='hidden'; |
|||
$("#" + otherTable +" > tbody > tr").each(function() { |
|||
var otableRow = this; |
|||
if(otableRow.className=='selected' && $(tableRow).attr("player") == $(otableRow).attr("player")){ |
|||
otableRow.className ='tab'; |
|||
} |
|||
}); |
|||
|
|||
}else if(tableRow.className=='selected') |
|||
{ |
|||
tableRow.className='tab'; |
|||
$("#" + otherTable +" > tbody > tr").each(function() { |
|||
var otableRow = this; |
|||
if(otableRow.className=='displayed' && $(tableRow).attr("player") == $(otableRow).attr("player")){ |
|||
otableRow.className ='hidden'; |
|||
} |
|||
}); |
|||
}else |
|||
{ |
|||
tableRow.className='selected'; |
|||
$("#" + otherTable +" > tbody > tr").each(function() { |
|||
var otableRow = this; |
|||
if(otableRow.className=='hidden' && $(tableRow).attr("player") == $(otableRow).attr("player")){ |
|||
otableRow.className ='displayed'; |
|||
} |
|||
}); |
|||
} |
|||
} |
|||
}); |
|||
} |
|||
</script> |
|||
|
|||
</head> |
|||
<body> |
|||
|
|||
<c:set var="players" value="${requestScope.Tplayers}" /> |
|||
<c:set var="stats" value="${players[0].stats}" /> |
|||
|
|||
<table id="${tableName}" class="tableTrade" > |
|||
|
|||
<thead> |
|||
<tr class="Header"> |
|||
<th align="left"><c:out value="Pos" /></th> |
|||
<th align="left" style="width:120px"><c:out value="Players" /></th> |
|||
<th align="left"><c:out value="Team RK" /></th> |
|||
<c:forEach var="stat" items= "${stats}" varStatus="i"> |
|||
<th ><c:out value="${stat.name}" /></th> |
|||
</c:forEach> |
|||
</tr> |
|||
</thead> |
|||
|
|||
<tbody style="font-size:16px;font-weight: bold; "> |
|||
<c:forEach var="player" items= "${players}" varStatus="i"> |
|||
<tr style="height:20px;" class="tab" id="${i.index}" tid="${teamID}" teamid="${player.teamID}" player="${player.nom}" onclick="RowClick(this,'${tableName}','${otherTableName}');"> |
|||
|
|||
<c:set var="stats" value="${player.stats}" /> |
|||
|
|||
<td> |
|||
<c:forEach items="${player.positions}" var="position"> |
|||
<c:out value="${position}," /> |
|||
</c:forEach> |
|||
</td> |
|||
|
|||
<td style="width:120px;text-align:left;" ><c:out value="${player.nom}" /></td> |
|||
<td name="player" align="center"><fmt:formatNumber pattern="0.#" value="${player.interRK}" /></td> |
|||
|
|||
<c:forEach var="stat" items= "${stats}" varStatus="i"> |
|||
<td style="align:center"><c:out value="${stat.statVal}" /></td> |
|||
</c:forEach> |
|||
|
|||
</tr> |
|||
</c:forEach> |
|||
</tbody> |
|||
</table> |
|||
|
|||
|
|||
</body> |
|||
</html> |
|||
|
|||
|
|||
@ -0,0 +1,407 @@ |
|||
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" |
|||
pageEncoding="ISO-8859-1"%> |
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
|||
<link href="${pageContext.request.contextPath}/CSS/style.css" rel="stylesheet" type="text/css" > |
|||
|
|||
<title>team</title> |
|||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> |
|||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> |
|||
<%@ taglib uri = "http://java.sun.com/jsp/jstl/functions" prefix = "fn" %> |
|||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> |
|||
|
|||
<script> |
|||
|
|||
$(document).ready(function() { |
|||
|
|||
var ln = parseInt('${team1Stats.size()}'); |
|||
|
|||
//$(document).ready(function() { |
|||
var headers = $("[name='headers']"); |
|||
var lignesResults = $("[name='lignesResults']"); |
|||
|
|||
var nbTeam = $(headers).find("th").size() - ln *2 -12; |
|||
|
|||
|
|||
|
|||
// color impact in center columns |
|||
var impSel = $("[name='impSel']"); |
|||
for (x=0;x<$(impSel).size();x++){ |
|||
var n = ""+(parseFloat($(impSel).eq(x).text())); |
|||
if(n>0){ |
|||
$(impSel).eq(x).text("+" + n); |
|||
$(impSel).eq(x).removeClass("negative").addClass("positive"); |
|||
}else{ |
|||
$(impSel).eq(x).removeClass("positive").addClass("negative"); |
|||
} |
|||
} |
|||
|
|||
var entete = $("[name='headers']"); |
|||
//hide ft / fg stats |
|||
$(entete).find('th').each (function() { |
|||
if($(this).text().includes("/")){ |
|||
$(this).hide(); |
|||
} |
|||
}); |
|||
var entete2 = $("[name='headersTop']"); |
|||
//hide ft / fg stats |
|||
$(entete2).find('th').each (function() { |
|||
if($(this).text().includes("/")){ |
|||
$(this).hide(); |
|||
} |
|||
}); |
|||
var entete3 = $("[name='headersMid']"); |
|||
//hide ft / fg stats |
|||
$(entete3).find('th').each (function() { |
|||
if($(this).text().includes("/")){ |
|||
$(this).hide(); |
|||
} |
|||
}); |
|||
var tradeProjSel = $("td[name='tradeProjSel']"); |
|||
//hide ft / fg stats |
|||
$(tradeProjSel).each (function() { |
|||
if($(this).text().includes("/")){ |
|||
$(this).hide(); |
|||
} |
|||
}); |
|||
|
|||
//color other team points |
|||
var actualProj = $("[name='actualProj']"); |
|||
var cat = $("[name='cat']"); |
|||
var z = 0; |
|||
for (x=0;x<$(tradeProjSel).size();x++){ |
|||
if(z==$(cat).size()){z=0;} |
|||
if(z>$(cat).size()-nbTeam-1){ |
|||
var n = ""+(parseFloat($(tradeProjSel).eq(x).text()) - parseFloat($(actualProj).eq(z).text())); |
|||
if(n>0){ |
|||
$(tradeProjSel).eq(x).removeClass("negative").addClass("positive"); |
|||
}else{ |
|||
$(tradeProjSel).eq(x).removeClass("positive").addClass("negative"); |
|||
} |
|||
|
|||
} |
|||
z+=1; |
|||
} |
|||
|
|||
var sort = $("[name='sort']"); |
|||
$(sort).each(function(col) { |
|||
$(this).hover( |
|||
function() { $(this).addClass('focus'); }, |
|||
function() { $(this).removeClass('focus'); } |
|||
); |
|||
|
|||
if($(this).text()=="TOT RD"){ |
|||
$(this).addClass('desc selected'); |
|||
} |
|||
|
|||
$(this).click(function() { |
|||
if ($(this).is('.desc')) { |
|||
$(this).removeClass('desc'); |
|||
$(this).addClass('asc selected'); |
|||
sortOrder = 1; |
|||
} |
|||
else { |
|||
$(this).addClass('desc selected'); |
|||
$(this).removeClass('asc'); |
|||
sortOrder = -1; |
|||
} |
|||
$(this).siblings().removeClass('asc selected'); |
|||
$(this).siblings().removeClass('desc selected'); |
|||
|
|||
var arrData = $('table').find("tr[name='lignesResults']"); |
|||
/* var arrData = $('table').find('tbody:nth-of-type(2) > tr').get(); */ |
|||
|
|||
arrData.sort(function(a, b) { |
|||
var val1 = $(a).children('td').eq(col+${nbStats}+4).text().replace("+","").toUpperCase(); |
|||
var val2 = $(b).children('td').eq(col+${nbStats}+4).text().replace("+","").toUpperCase(); |
|||
if($.isNumeric(val1) && $.isNumeric(val2)) |
|||
return sortOrder == 1 ? val1-val2 : val2-val1; |
|||
else |
|||
return (val1 < val2) ? -sortOrder : (val1 > val2) ? sortOrder : 0; |
|||
}); |
|||
|
|||
|
|||
|
|||
$.each(arrData, function(index, row) { |
|||
$('tbody:nth-of-type(2)').append(row); |
|||
}); |
|||
}); |
|||
}); |
|||
|
|||
|
|||
$("#everything-wrapper").fadeIn(); |
|||
$('#loader').hide(); |
|||
}); |
|||
|
|||
function listDiff(Elem) |
|||
{ |
|||
|
|||
var impSel = $(Elem).find("td[name='impSel']"); |
|||
var imp = $("[name='imp']"); |
|||
var drop = $(Elem).find("td[name='drop']"); |
|||
var get = $(Elem).find("td[name='get']"); |
|||
var actualPlayers = $("[name='actualPlayers']"); |
|||
var tradePlayers = $("[name='tradePlayers']"); |
|||
var cat = $("[name='cat']"); |
|||
var actualProj = $("[name='actualProj']"); |
|||
var tradeProj = $("[name='tradeProj']"); |
|||
var diff = $("[name='diff']") |
|||
var tradeProjSel = $(Elem).find("td[name='tradeProjSel']"); |
|||
|
|||
$(actualPlayers).eq(0).text($(drop).eq(0).text()); |
|||
$(tradePlayers).eq(0).text($(get).eq(0).text()); |
|||
//$(actualPlayers).eq(1).text($(drop).eq(1).text()); |
|||
//$(tradePlayers).eq(1).text($(get).eq(1).text()); |
|||
|
|||
for (x=0;x<$(impSel).size();x++){ |
|||
$(imp).eq(x).text($(impSel).eq(x).text()); |
|||
var n = ""+(parseFloat($(imp).eq(x).text())); |
|||
if(n>0){ |
|||
$(imp).eq(x).removeClass("negative").addClass("positive"); |
|||
}else{ |
|||
$(imp).eq(x).removeClass("positive").addClass("negative"); |
|||
} |
|||
} |
|||
|
|||
for (x=0;x<$(cat).size();x++){ |
|||
|
|||
if($(cat).eq(x).text().includes('/')){ |
|||
var decomp = $(tradeProjSel).eq(x).text().split("/"); |
|||
var decomp2 = $(actualProj).eq(x).text().split("/"); |
|||
|
|||
$(tradeProj).eq(x).text(parseFloat(decomp[0]).toFixed(0) + "/" + parseFloat(decomp[1]).toFixed(0)); |
|||
|
|||
var valProj1 = parseFloat(decomp[0]) - parseFloat(decomp2[0]); |
|||
var valProj2 = parseFloat(decomp[1]) - parseFloat(decomp2[1]); |
|||
$(diff).eq(x).text(valProj1.toFixed(0) + "/" + valProj2.toFixed(0));//remaining points |
|||
}else if($(cat).eq(x).text().includes('%')){ |
|||
$(tradeProj).eq(x).text(parseFloat($(tradeProjSel).eq(x).text()).toFixed(2)); |
|||
var n = (parseFloat($(tradeProj).eq(x).text()) - parseFloat($(actualProj).eq(x).text())).toFixed(2); |
|||
if(n>0){ |
|||
$(diff).eq(x).text("+" + n); |
|||
$(diff).eq(x).removeClass("negative").addClass("positive"); |
|||
$(diff).eq(x+1).removeClass("negative").addClass("positive"); |
|||
}else{ |
|||
$(diff).eq(x).text(n); |
|||
$(diff).eq(x).removeClass("positive").addClass("negative"); |
|||
$(diff).eq(x+1).removeClass("positive").addClass("negative"); |
|||
} |
|||
}else if($(cat).eq(x).text() == 'TO'){ |
|||
$(tradeProj).eq(x).text(parseFloat($(tradeProjSel).eq(x).text())); |
|||
var n = ""+(parseFloat($(tradeProj).eq(x).text()) - parseFloat($(actualProj).eq(x).text())); |
|||
if(n>0){ |
|||
$(diff).eq(x).text("+" + n); |
|||
$(diff).eq(x).removeClass("positive").addClass("negative"); |
|||
}else{ |
|||
$(diff).eq(x).text(n); |
|||
$(diff).eq(x).removeClass("negative").addClass("positive"); |
|||
} |
|||
}else{ |
|||
$(tradeProj).eq(x).text(parseFloat($(tradeProjSel).eq(x).text())); |
|||
//inverse diff si col RK |
|||
if($(cat).eq(x).text() == 'RK'){ |
|||
var n = ""+(parseFloat($(actualProj).eq(x).text()) - parseFloat($(tradeProj).eq(x).text())); |
|||
if(n>0){ |
|||
$(diff).eq(x).text("+" + n); |
|||
$(diff).eq(x).removeClass("negative").addClass("positive"); |
|||
}else{ |
|||
$(diff).eq(x).text(n); |
|||
$(diff).eq(x).removeClass("positive").addClass("negative"); |
|||
} |
|||
}else{ |
|||
var n = parseFloat($(tradeProj).eq(x).text()) - parseFloat($(actualProj).eq(x).text()); |
|||
if(n>0){ |
|||
$(diff).eq(x).text("+" + n); |
|||
$(diff).eq(x).removeClass("negative").addClass("positive"); |
|||
}else{ |
|||
$(diff).eq(x).text(n); |
|||
$(diff).eq(x).removeClass("positive").addClass("negative"); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
</script> |
|||
|
|||
</head> |
|||
<body onload=""> |
|||
|
|||
|
|||
<c:set var="mainTRADE" value="${requestScope.mainTRADE}" /> |
|||
<c:set var="stats" value="${requestScope.statBase}" /> |
|||
<c:set var="nbTeam" value="${requestScope.nbTeam}" /> |
|||
<c:set var="team1" value="${requestScope.team1}" /> |
|||
<c:set var="team1Stats" value="${requestScope.team1Stats}" /> |
|||
<c:set var="team2" value="${requestScope.team2}" /> |
|||
<c:set var="team2Stats" value="${requestScope.team2Stats}" /> |
|||
<c:set var="otherTeamStats" value="${requestScope.otherTeamStats}" /> |
|||
|
|||
<div id="everything-wrapper" > |
|||
|
|||
<table class="tableTrade" style="font-size: 7px;"> |
|||
|
|||
<thead "> |
|||
<!-- ajoute 3 titres de section ----- TEAM 2 -------------TEAM 2 --------OTHERS --> |
|||
<tr class="Header""> |
|||
<th name="tradeTab" rowspan="2" colspan="2"><c:out value="Traded players" /></th> |
|||
<th name="team1Tab" colspan="${(fn:length(stats)-nbTeam+2-6-2)/2 }"><c:out value="${team1.name}" /></th> |
|||
<th name="impTab" rowspan="2" colspan="6"><c:out value="Trade Impact" /></th> |
|||
<th name="team2Tab" colspan="${(fn:length(stats)-nbTeam+2-6-2)/2 }"><c:out value="${team2.name}" /></th> |
|||
<th name="impTeamTab" colspan="${nbTeam - 2}"><c:out value="Impact on other teams" /></th> |
|||
</tr> |
|||
|
|||
|
|||
<!-- STATS CAT --> |
|||
<tr name="headersTop" class="Header"> |
|||
<c:forEach var="stat" items= "${stats}" varStatus="i"> |
|||
<c:if test="${stat.name == 'RK-P'}"> |
|||
|
|||
<c:if test="${i.first}"> |
|||
|
|||
</c:if> |
|||
<th ><c:out value="RK" /></th> |
|||
</c:if> |
|||
<c:if test="${stat.name != 'IMP'}"> |
|||
<th><c:out value="${stat.name}" /></th> |
|||
</c:if> |
|||
</c:forEach> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<!-- LIGNE ACTUAL STATS PROJECTION--> |
|||
<tr name="headersTop" class="ligneHead" "> |
|||
<c:forEach var="stat" items= "${team1Stats}" varStatus="i"> |
|||
<c:if test="${i.first}"> |
|||
<th name="actualPlayers" rowspan="3">T1 trade</th> |
|||
<th name="tradePlayers" rowspan="3">T1 trade</th> |
|||
<th name="actualProj"><fmt:formatNumber pattern="0.#" value="${team1projectedRK}" /></th> |
|||
<th name="actualProj"><fmt:formatNumber pattern="0.#" value="${team1projTot}" /></th> |
|||
</c:if> |
|||
<th name="actualProj"><c:out value="${stat.valProjection}" /></th> |
|||
</c:forEach> |
|||
|
|||
<th colspan="6">ACTUAL PROJECTION</th> |
|||
|
|||
<c:forEach var="stat" items= "${team2Stats}" varStatus="i" > |
|||
<c:if test="${i.first}"> |
|||
<th name="actualProj"><fmt:formatNumber pattern="0.#" value="${team2projectedRK}" /></th> |
|||
<th name="actualProj"><fmt:formatNumber pattern="0.#" value="${team2projTot}" /></th> |
|||
</c:if> |
|||
<th name="actualProj"><c:out value="${stat.valProjection}" /></th> |
|||
</c:forEach> |
|||
|
|||
<c:forEach var="stat" items= "${otherTeamStats}" > |
|||
<th name="actualProj"><c:out value="${stat}" /></th> |
|||
</c:forEach> |
|||
</tr> |
|||
|
|||
<!-- LIGNE WITH TRADE STATS PROJECTION--> |
|||
<tr name="headersMid" class="ligneHead" "> |
|||
<c:forEach var="stat" items= "${stats}" varStatus="i"> |
|||
<c:if test="${i.first}"> |
|||
|
|||
</c:if> |
|||
<c:if test="${stat.name == 'RK-P'}"> |
|||
<th name="tradeProj"><c:out value="--" /></th> |
|||
</c:if> |
|||
<c:if test="${stat.name != 'IMP'}"> |
|||
<c:if test="${stat.name.contains('/')}"> |
|||
<th name="tradeProj"><c:out value="--/--" /></th> |
|||
</c:if> |
|||
<c:if test="${!stat.name.contains('/')}"> |
|||
<th name="tradeProj"><c:out value="--" /></th> |
|||
</c:if> |
|||
</c:if> |
|||
<c:if test="${stat.name == 'IMP'}"> |
|||
<th name="imp"><c:out value="<>" /></th> |
|||
</c:if> |
|||
|
|||
</c:forEach> |
|||
</tr> |
|||
<!------------- LIGNE DIFFERENCES -----> |
|||
<tr name="headersTop" class="ligneHead" "> |
|||
<c:forEach var="stat" items= "${stats}" varStatus="i"> |
|||
<c:if test="${stat.name == 'RK-P'}"> |
|||
<c:if test="${!i.first}"> |
|||
<th colspan="6">DIFFERENCES</th> |
|||
</c:if> |
|||
<c:if test="${i.first}"> |
|||
|
|||
</c:if> |
|||
<th id="diff" name="diff"><c:out value="--" /></th> |
|||
</c:if> |
|||
<c:if test="${stat.name != 'IMP'}"> |
|||
<c:if test="${stat.name.contains('/')}"> |
|||
<th id="diff" name="diff"><c:out value="--/--" /></th> |
|||
</c:if> |
|||
<c:if test="${!stat.name.contains('/')}"> |
|||
<th id="diff" name="diff"><c:out value="--" /></th> |
|||
</c:if> |
|||
</c:if> |
|||
</c:forEach> |
|||
</tr> |
|||
</tbody> |
|||
<thead> |
|||
<!------ DROP GET / REPEAT STATS CAT -----> |
|||
<tr name="headers" class="Header" "> |
|||
<c:forEach var="stat" items= "${stats}" varStatus="i"> |
|||
<c:if test="${stat.name == 'RK-P'}"> |
|||
<c:if test="${!i.first}"> |
|||
<th name="sort">RK D</th> |
|||
<th name="sort">PT D</th> |
|||
<th name="sort">TOT RD</th> |
|||
<th name="sort">TOT PD</th> |
|||
<th name="sort">RK D</th> |
|||
<th name="sort">PT D</th> |
|||
</c:if> |
|||
<c:if test="${i.first}"> |
|||
<th ><c:out value="${team1.name}" /></th> |
|||
<th ><c:out value="${team2.name}" /></th> |
|||
</c:if> |
|||
|
|||
<th name="cat"><c:out value="RK" /></th> |
|||
</c:if> |
|||
<c:if test="${stat.name != 'IMP'}"> |
|||
<th name="cat"><c:out value="${stat.name}" /></th> |
|||
</c:if> |
|||
</c:forEach> |
|||
</tr> |
|||
</thead> |
|||
<!------------------------ START RESULT TAB--------------------------------> |
|||
<tbody id="tTradediv" style=""> |
|||
<c:forEach var="trade" items= "${mainTRADE}" varStatus="j"> |
|||
|
|||
<tr name="lignesResults" class="tab" id="${i.index}" onclick="return listDiff(this);"> |
|||
<c:forEach var="stat" items= "${trade}" varStatus="i" > |
|||
<c:if test="${i.first}"> |
|||
<td name="drop"><c:out value="${stat.player}" /></td> |
|||
<td name="get"><c:out value="${stat.team}" /></td> |
|||
</c:if> |
|||
<c:if test="${stat.name == 'RK-P'}"> |
|||
<td name="tradeProjSel" align="center"><fmt:formatNumber pattern="0.#" value="${stat.projectedRK}" /></td> |
|||
</c:if> |
|||
<c:if test="${stat.name != 'IMP'}"> |
|||
<td name="tradeProjSel" align="center"><c:out value="${stat.valProjection}" /></td> |
|||
</c:if> |
|||
<c:if test="${stat.name == 'IMP'}"> |
|||
<td name="impSel" align="center"><c:out value="${stat.valProjection}" /></td> |
|||
</c:if> |
|||
|
|||
</c:forEach> |
|||
|
|||
</tr> |
|||
|
|||
</c:forEach> |
|||
</tbody> |
|||
|
|||
</table> |
|||
</div> |
|||
</body> |
|||
</html> |
|||
|
|||
|
|||
@ -0,0 +1,3 @@ |
|||
Manifest-Version: 1.0 |
|||
Class-Path: |
|||
|
|||
@ -0,0 +1,7 @@ |
|||
#Generated by Maven Integration for Eclipse |
|||
#Mon Oct 22 16:28:29 CEST 2018 |
|||
m2e.projectLocation=C\:\\Users\\lejay\\eclipse-workspace\\sd.zip_expanded\\FantasyManager |
|||
m2e.projectName=FantasyManager |
|||
groupId=FantasyManager |
|||
artifactId=FantasyManager |
|||
version=0.0.1-SNAPSHOT |
|||
@ -0,0 +1,81 @@ |
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
<groupId>FantasyManager</groupId> |
|||
<artifactId>FantasyManager</artifactId> |
|||
<version>0.0.1-SNAPSHOT</version> |
|||
<build> |
|||
<sourceDirectory>src</sourceDirectory> |
|||
<plugins> |
|||
<plugin> |
|||
<artifactId>maven-compiler-plugin</artifactId> |
|||
<version>3.7.0</version> |
|||
<configuration> |
|||
<source>1.8</source> |
|||
<target>1.8</target> |
|||
</configuration> |
|||
</plugin> |
|||
<plugin> |
|||
<artifactId>maven-war-plugin</artifactId> |
|||
<version>3.0.0</version> |
|||
<configuration> |
|||
<warSourceDirectory>WebContent</warSourceDirectory> |
|||
</configuration> |
|||
</plugin> |
|||
</plugins> |
|||
</build> |
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>com.google.visualization</groupId> |
|||
<artifactId>visualization-datasource</artifactId> |
|||
<version>1.1.1</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.fasterxml.jackson.core</groupId> |
|||
<artifactId>jackson-core</artifactId> |
|||
<version>2.9.2</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.fasterxml.jackson.core</groupId> |
|||
<artifactId>jackson-annotations</artifactId> |
|||
<version>2.9.2</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>com.fasterxml.jackson.core</groupId> |
|||
<artifactId>jackson-databind</artifactId> |
|||
<version>2.9.2</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.jsoup</groupId> |
|||
<artifactId>jsoup</artifactId> |
|||
<version>1.9.1</version> |
|||
</dependency> |
|||
|
|||
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson --> |
|||
<dependency> |
|||
<groupId>com.google.code.gson</groupId> |
|||
<artifactId>gson</artifactId> |
|||
<version>2.3.1</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>mysql</groupId> |
|||
<artifactId>mysql-connector-java</artifactId> |
|||
<version>5.1.39</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>io.webfolder</groupId> |
|||
<artifactId>ui4j-webkit</artifactId> |
|||
<version>3.1.0</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>org.seleniumhq.selenium</groupId> |
|||
<artifactId>selenium-firefox-driver</artifactId> |
|||
<version>3.13.0</version> |
|||
</dependency> |
|||
|
|||
|
|||
</dependencies> |
|||
<packaging>war</packaging> |
|||
</project> |
|||
@ -0,0 +1,419 @@ |
|||
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" |
|||
pageEncoding="ISO-8859-1"%> |
|||
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
|||
<link href="${pageContext.request.contextPath}/CSS/style.css" rel="stylesheet" type="text/css" > |
|||
<title>Insert title here</title> |
|||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> |
|||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> |
|||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> |
|||
<!--Load the AJAX API--> |
|||
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> |
|||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> |
|||
<script type="text/javascript"> |
|||
|
|||
$(document).ready(function() { |
|||
//-------------desactivate btn trade >>> need import players------------ |
|||
//document.getElementById("btnTrade").disabled = true; |
|||
var rows = $('table').find("tr[name='ligne']"); |
|||
var rowsInTable = $(rows).size(); |
|||
var height = 267 / rowsInTable; |
|||
$(rows).each(function() { |
|||
$(this).css("height", height); |
|||
}); |
|||
|
|||
var head = $("th[name='head']"); |
|||
var x= 0; |
|||
$(head).each(function() { |
|||
if(x==0){ |
|||
$(this).css("width", 110.6); |
|||
}else if(x==1 || x==3 || x==5 || x==7){ |
|||
$(this).css("width", 25); //140 |
|||
}else { |
|||
$(this).css("width", 45); //135 |
|||
} |
|||
|
|||
x+=1; |
|||
}); |
|||
|
|||
|
|||
|
|||
}); //end doc ready |
|||
|
|||
|
|||
$(window).load(function() { |
|||
|
|||
var totproj = $("[name='totproj']"); |
|||
var RKproj = $("[name='RKproj']"); |
|||
var RKteam = $("[name='RKteam']"); |
|||
var RKrel = $("[name='RKrel']"); |
|||
var tot = $("[name='tot']"); |
|||
var totRel = $("[name='totRel']"); |
|||
var nbTeam = '${teamList.size()}'; |
|||
var tmp = generateColor('#ffd157','#ff0000',nbTeam/2); |
|||
var tmp2 = generateColor('#00d700','#ffff00',nbTeam/2); |
|||
$.merge(tmp,tmp2); |
|||
var z = 0; |
|||
$(tot).each(function() { |
|||
for(x=0;x<nbTeam;x++){ |
|||
if($(RKteam).eq(z).text() < nbTeam - x +0.5 && $(RKteam).eq(z).text() >= nbTeam - x -0.5){ |
|||
$(this).css('background', 'linear-gradient(#'+tmp[x] + ', #ffffff)'); |
|||
$(this).css('text-shadow' , '0 1px 0 ##261300'); |
|||
} |
|||
} |
|||
z+=1; |
|||
}); |
|||
z = 0; |
|||
$(totRel).each(function() { |
|||
for(x=0;x<nbTeam;x++){ |
|||
if($(RKrel).eq(z).text() < nbTeam - x +0.5 && $(RKrel).eq(z).text() >= nbTeam - x -0.5){ |
|||
$(this).css('background', 'linear-gradient(#'+tmp[x] + ', #ffffff)' ); |
|||
$(this).css('text-shadow' , '0 1px 0 ##261300'); |
|||
} |
|||
} |
|||
z+=1; |
|||
}); |
|||
z = 0; |
|||
$(totproj).each(function() { |
|||
for(x=0;x<nbTeam;x++){ |
|||
if($(RKproj).eq(z).text() < nbTeam - x +0.5 && $(RKproj).eq(z).text() >= nbTeam - x -0.5){ |
|||
$(this).css('background', 'linear-gradient(#'+tmp[x] + ', #ffffff)'); |
|||
$(this).css('text-shadow' , '0 1px 0 ##261300'); |
|||
} |
|||
} |
|||
z+=1; |
|||
}); |
|||
|
|||
|
|||
function hex (c) { |
|||
var s = "0123456789abcdef"; |
|||
var i = parseInt (c); |
|||
if (i == 0 || isNaN (c)) |
|||
return "00"; |
|||
i = Math.round (Math.min (Math.max (0, i), 255)); |
|||
return s.charAt ((i - i % 16) / 16) + s.charAt (i % 16); |
|||
} |
|||
|
|||
/* Convert an RGB triplet to a hex string */ |
|||
function convertToHex (rgb) { |
|||
return hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]); |
|||
} |
|||
|
|||
/* Remove '#' in color hex string */ |
|||
function trim (s) { return (s.charAt(0) == '#') ? s.substring(1, 7) : s } |
|||
|
|||
/* Convert a hex string to an RGB triplet */ |
|||
function convertToRGB (hex) { |
|||
var color = []; |
|||
color[0] = parseInt ((trim(hex)).substring (0, 2), 16); |
|||
color[1] = parseInt ((trim(hex)).substring (2, 4), 16); |
|||
color[2] = parseInt ((trim(hex)).substring (4, 6), 16); |
|||
return color; |
|||
} |
|||
|
|||
function generateColor(colorStart,colorEnd,colorCount){ |
|||
// The beginning of your gradient |
|||
var start = convertToRGB (colorStart); |
|||
// The end of your gradient |
|||
var end = convertToRGB (colorEnd); |
|||
// The number of colors to compute |
|||
var len = colorCount; |
|||
//Alpha blending amount |
|||
var alpha = 0.0; |
|||
var saida = []; |
|||
for (i = 0; i < len; i++) { |
|||
var c = []; |
|||
alpha += (1.0/len); |
|||
|
|||
c[0] = start[0] * alpha + (1 - alpha) * end[0]; |
|||
c[1] = start[1] * alpha + (1 - alpha) * end[1]; |
|||
c[2] = start[2] * alpha + (1 - alpha) * end[2]; |
|||
|
|||
saida.push(convertToHex (c)); |
|||
} |
|||
return saida; |
|||
} |
|||
}); //end doc ready |
|||
|
|||
|
|||
function rebuildGraph() { |
|||
$.ajax({ |
|||
url:'CALL_Rebuild', |
|||
type:'post', |
|||
success:function(response) |
|||
{ |
|||
drawMain(); |
|||
|
|||
} |
|||
}); |
|||
} |
|||
|
|||
var stats = '${statsJson}'; |
|||
var json = JSON.parse(stats); |
|||
|
|||
drawMain(); |
|||
|
|||
function drawMain() { |
|||
$.ajax({ |
|||
url:'GRAPH_CALL', |
|||
type:'post', |
|||
data: {typeGraph: "mainGraph"}, |
|||
success:function(response) |
|||
{ |
|||
$("#cont_chart_div").html(response); |
|||
$('#loader').hide(); |
|||
|
|||
//---------------------------------------change to load graphs |
|||
|
|||
drawMaxPace(); |
|||
|
|||
} |
|||
}); |
|||
} |
|||
|
|||
function drawStat(x) { |
|||
$.ajax( |
|||
{ |
|||
url:'GRAPH_CALL', |
|||
type:'post', |
|||
data: {typeGraph: json[x]["name"]}, |
|||
success:function(response) |
|||
{ |
|||
$("#cont_"+json[x]["name"].replace("%","")).html(response); |
|||
|
|||
if(json[x]["name"] != "PTS"){ |
|||
if(json[x+1]["name"].includes("/")){ |
|||
drawStat(x+2); |
|||
}else{ |
|||
drawStat(x+1); |
|||
|
|||
} |
|||
|
|||
}else{ |
|||
|
|||
//drawLast(x); |
|||
|
|||
} |
|||
$('#loader'+json[x]["name"].replace("%","")).hide(); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
function drawLast(x) { |
|||
$.ajax( |
|||
{ |
|||
url:'GRAPH_CALL', |
|||
type:'post', |
|||
data: {typeGraph: json[x]["name"]}, |
|||
success:function(response) |
|||
{ |
|||
$("#cont_"+json[x]["name"].replace("%","")).html(response); |
|||
$('#loader'+json[x]["name"].replace("%","")).hide(); |
|||
|
|||
} |
|||
|
|||
}); |
|||
} |
|||
|
|||
function loader() { |
|||
|
|||
$.ajax({ |
|||
url:'LoadTester', |
|||
type:'get', |
|||
success:function(response) |
|||
{ |
|||
//$("#trade_div").html(response); |
|||
document.getElementById("btnTrade").disabled = false; |
|||
|
|||
//--------------BTN LIGNE LEAM---------------need import player stats |
|||
$(document).on("click","tr", function(e){ |
|||
document.getElementById($(this).index()).submit(); |
|||
}); |
|||
|
|||
|
|||
drawStat(0); |
|||
|
|||
} |
|||
}); |
|||
} |
|||
|
|||
|
|||
function drawMaxPace() { |
|||
|
|||
|
|||
|
|||
$.ajax( |
|||
{ |
|||
url:'CALL_DIV_maxPace', |
|||
type:'post', |
|||
data: {}, |
|||
success:function(response) |
|||
{ |
|||
$("#cont_maxPace").html(response); |
|||
$('#loaderMaxPace').hide(); |
|||
|
|||
loader(); |
|||
|
|||
} |
|||
}); |
|||
|
|||
} |
|||
</script> |
|||
|
|||
|
|||
</head> |
|||
<body> |
|||
|
|||
|
|||
<c:set var="teams" value="${sessionScope.teamList}" /> |
|||
<c:set var="stats" value="${requestScope.statsBase}" /> |
|||
|
|||
|
|||
<div class="wrapper"> |
|||
|
|||
<header class="main-head"> |
|||
|
|||
</header> |
|||
|
|||
|
|||
<article class="graph"> |
|||
<ul class="listing"> |
|||
|
|||
<li class="superwide"> |
|||
<div class="HeaderDiv" style="width:100%;line-height: 20px;text-align: center;"><c:out value="League ${leagueName} - ${season} Rotisserie - Day : ${day} / ${totDays}" /></div> |
|||
|
|||
<div style="width: 100%;text-align: center;margin-bottom:10px;"> |
|||
<div style="display: inline-block;vertical-align:top;"> |
|||
<form name='TradeForm' method='post' action='tradeServlet'> |
|||
<input id='btnTrade' type='submit' value='Trade' /></form> |
|||
</div> |
|||
<div style="display: inline-block;vertical-align:top;"> |
|||
<input id="btnRebuild" type="button" value="Rebuild Graph" onclick="rebuildGraph();" /> |
|||
</div> |
|||
</div> |
|||
</li> |
|||
|
|||
<li> |
|||
<table class="tableTrade"> |
|||
<thead> |
|||
<tr class="Header" style="line-height: 20px;"> |
|||
<th colspan="4">ESPN RANKING</th> |
|||
<th colspan="2">RELATIVE</th> |
|||
<th colspan="2">PROJECTION</th> |
|||
</tr> |
|||
<tr class="Header" style="line-height: 20px;"> |
|||
<th name="head" style="text-align:left">TEAM</th> |
|||
<th name="head">GP</th> |
|||
<th name="head" style="width: 49px;">ESPN PTS</th> |
|||
<th name="head">E-RK</th> |
|||
<th name="head" style="width: 49px;">REL PTS</th> |
|||
<th name="head">R-RK</th> |
|||
<th name="head" style="width: 49px;">PROJ PTS</th> |
|||
<th name="head">P-RK</th> |
|||
</tr> |
|||
<%-- <tr class="Header" ><th align="left"><c:out value="Team" /></th> |
|||
<c:forEach var="stat" items= "${stats}" > |
|||
<th><c:out value="${stat.name}" /></th> |
|||
</c:forEach> |
|||
<th><c:out value="ESPN Pts" /></th> |
|||
<th><c:out value="REL Pts" /></th> |
|||
</tr> --%> |
|||
</thead> |
|||
<tbody> |
|||
<c:forEach var="team" items= "${teams}" > |
|||
<tr name="ligne" class="tab"> |
|||
<td style="text-align:left;"><strong><c:out value="${team.name}" /></strong></td> |
|||
<%-- <c:forEach var="stat" items= "${team.stats}" > |
|||
<td align="center"><c:out value="${stat.valRot}" /></td> |
|||
</c:forEach> --%> |
|||
<td align="center"><c:out value="${team.gamesPlayed}" /></td> |
|||
<td name="tot" align="center"><fmt:formatNumber pattern="0.#" value="${team.totalrotPts}" /></td> |
|||
<td name="RKteam" align="center"><fmt:formatNumber pattern="0.#" value="${team.RK}" /></td> |
|||
<td name="totRel" align="center"><fmt:formatNumber pattern="0.#" value="${team.totalrotPtsRel}" /></td> |
|||
<td name="RKrel" align="center"><fmt:formatNumber pattern="0.#" value="${team.relativeRK}" /></td> |
|||
<td name="totproj" align="center"><fmt:formatNumber pattern="0.#" value="${team.projTot}" /></td> |
|||
<td name="RKproj" align="center"><fmt:formatNumber pattern="0.#" value="${team.projRK}" /></td> |
|||
<form id="${team.ID}" action="teamServlet" method="post" > |
|||
<input type="submit" style="display:none;"/> |
|||
<input type="hidden" name="teamId" value="${team.ID}"/> |
|||
</form> |
|||
</tr> |
|||
</c:forEach> |
|||
</tbody> |
|||
</table> |
|||
</li> |
|||
|
|||
<li class="wide"> |
|||
|
|||
<div class="HeaderDiv" style="line-height: 20px;text-align: center;"><c:out value="RANKING EVOLUTION RELATIVE TO GAMES PLAYED" /></div> |
|||
<div class="cn"> |
|||
<div id="cont_chart_div" style="height: 295px;"> |
|||
<div id="loader" style="width: 100%;text-align: center;display:block;vertical-align:center; margin-top: 135px"> |
|||
<span>Buildind RK Graph</span> |
|||
<span class="l-1"></span> |
|||
<span class="l-2"></span> |
|||
<span class="l-3"></span> |
|||
<span class="l-4"></span> |
|||
<span class="l-5"></span> |
|||
<span class="l-6"></span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</li> |
|||
|
|||
<c:forEach var="stat" items= "${stats}" varStatus="i"> |
|||
<c:if test="${!fn:contains(stat.name,'/')}"> |
|||
<li > |
|||
<div class="HeaderDiv" style="line-height: 20px;text-align: center;"><c:out value="${stat.name}" /></div> |
|||
|
|||
<div class="cn"> |
|||
|
|||
<div id="cont_${fn:replace(stat.name ,'%','')}" style="height: 200px;"> |
|||
<div id="loader${fn:replace(stat.name ,'%','')}" style="width: 100%;text-align: center; margin-top: 80px"> |
|||
<span><c:out value="Buildind ${stat.name} Graph" /></span> |
|||
<span class="l-1"></span> |
|||
<span class="l-2"></span> |
|||
<span class="l-3"></span> |
|||
<span class="l-4"></span> |
|||
<span class="l-5"></span> |
|||
<span class="l-6"></span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</li> |
|||
</c:if> |
|||
</c:forEach> |
|||
|
|||
<li class="superwide"> |
|||
|
|||
<div class="HeaderDiv" style="line-height: 20px;text-align: center;"><c:out value="MAX & PACE" /></div> |
|||
<div class="cn"> |
|||
<div id="cont_maxPace" style="width: 100%;"> |
|||
<div id="loadermaxPace" style="width: 100%;text-align: center;display:block;vertical-align:center; margin-top: 35px"> |
|||
<span>Calculating Max & Pace</span> |
|||
<span class="l-1"></span> |
|||
<span class="l-2"></span> |
|||
<span class="l-3"></span> |
|||
<span class="l-4"></span> |
|||
<span class="l-5"></span> |
|||
<span class="l-6"></span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
</li> |
|||
|
|||
</ul> |
|||
</article> |
|||
<!-- <footer class="main-footer">The footer</footer> --> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,566 @@ |
|||
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" |
|||
pageEncoding="ISO-8859-1"%> |
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
|||
<link href="${pageContext.request.contextPath}/CSS/style.css" rel="stylesheet" type="text/css" > |
|||
|
|||
<title>team</title> |
|||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> |
|||
<%@ taglib uri = "http://java.sun.com/jsp/jstl/functions" prefix = "fn" %> |
|||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> |
|||
|
|||
|
|||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> |
|||
<script type="text/javascript"> |
|||
|
|||
|
|||
$(window).load(function() { |
|||
var ln = parseInt('${team1Stats.size()}'); |
|||
|
|||
//$(document).ready(function() { |
|||
|
|||
var lignesResults = $("[name='lignesResults']"); |
|||
var z = 0; |
|||
$(lignesResults).each (function() { |
|||
z = 0; |
|||
$(this).find("td").each(function() { |
|||
if(z==0){ |
|||
$(this).css("width", "95"); |
|||
}else if (+z <= ln ){ |
|||
$(this).css("width", "28"); |
|||
}else { |
|||
$(this).css("width", "48"); |
|||
} |
|||
z+=1; |
|||
}); |
|||
}); |
|||
var headers = $("[name='headers']"); |
|||
$(headers).each (function() { |
|||
z=0; |
|||
$(this).find("th").each(function() { |
|||
if(z==0){ |
|||
$(this).css("width", "95"); |
|||
}else if (+z <= ln ){ |
|||
$(this).css("width", "28"); |
|||
}else{ |
|||
$(this).css("width", "48"); |
|||
} |
|||
z+=1; |
|||
}); |
|||
}); |
|||
|
|||
var statTab = $("[name='statTab']"); |
|||
var teamTab = $("[name='teamTab']"); |
|||
|
|||
$(statTab).css("width", 95+6.8 + (ln) * (28+6.8) -6.8); |
|||
$(teamTab).css("width", (48+6.8) * (z-ln-1) -6.8); |
|||
|
|||
|
|||
//color other team points |
|||
var tradeProjSel = $("td[name='tradeProjSel']"); |
|||
var actualProj = $("[name='actualProj']"); |
|||
var cat = $("[name='cat']"); |
|||
z = 0; |
|||
for (x=0;x<$(tradeProjSel).size();x++){ |
|||
if(z==$(cat).size()){z=0;} |
|||
if($(cat).eq(z).text() == "RK-P"){ |
|||
var n = ""+(parseFloat($(tradeProjSel).eq(x).text()) - parseFloat($(actualProj).eq(z).text())); |
|||
if(n>0){ |
|||
$(tradeProjSel).eq(x).addClass("positive"); |
|||
$(tradeProjSel).eq(x-1).addClass("positive"); |
|||
}else if(n==0){ |
|||
$(tradeProjSel).eq(x).addClass("neutral"); |
|||
$(tradeProjSel).eq(x-1).addClass("neutral"); |
|||
}else{ |
|||
$(tradeProjSel).eq(x).addClass("negative"); |
|||
$(tradeProjSel).eq(x-1).addClass("negative"); |
|||
} |
|||
} |
|||
if(z >= ln){ |
|||
var n = ""+(parseFloat($(tradeProjSel).eq(x).text()) - parseFloat($(actualProj).eq(z).text())); |
|||
if(n>0){ |
|||
$(tradeProjSel).eq(x).addClass("positive"); |
|||
}else if(n==0){ |
|||
$(tradeProjSel).eq(x).addClass("neutral"); |
|||
}else{ |
|||
$(tradeProjSel).eq(x).addClass("negative"); |
|||
} |
|||
} |
|||
z+=1; |
|||
} |
|||
|
|||
var actual = $(actualProj).eq(1).text(); |
|||
var potPTScell = $("[name='potPTScell']"); |
|||
var potRKcell = $("[name='potRKcell']"); |
|||
z = 0; |
|||
$(potPTScell).each (function() { |
|||
var n = ""+(parseFloat($(this).text()) - parseFloat(actual)); |
|||
if(n>0){ |
|||
$(this).addClass("positive"); |
|||
$(potRKcell).eq(z).addClass("positive"); |
|||
}else if(n==0){ |
|||
$(this).addClass("neutral"); |
|||
$(potRKcell).eq(z).addClass("neutral"); |
|||
}else{ |
|||
$(this).addClass("negative"); |
|||
$(potRKcell).eq(z).addClass("negative") |
|||
} |
|||
z+=1; |
|||
}); |
|||
|
|||
//var player = $("[name='player']"); |
|||
//callfilterResults($(player).eq(0).text()); |
|||
|
|||
// var potRK = '${potRKJson}'; |
|||
// var potRKJson = JSON.parse(potRK); |
|||
// var potRKcell = $("[name='potRKcell']"); |
|||
// x=0; |
|||
// $(potRKcell).each(function(col) { |
|||
// $(this).text(potRKJson[x]); |
|||
// x+=1; |
|||
// }); |
|||
|
|||
// var potPts = '${potPtsJson}'; |
|||
// var potPtsJson = JSON.parse(potPts); |
|||
// var potPTScell = $("[name='potPTScell']"); |
|||
// var x=0; |
|||
// $(potPTScell).each(function(col) { |
|||
// $(this).text(potPtsJson[x]); |
|||
// x+=1; |
|||
// }); |
|||
/* var actualProj = $("[name='actualProj']"); |
|||
var actual = $(actualProj).eq(1).text(); |
|||
// Declare variables |
|||
var input, filter, table, tr, td,td2, i; |
|||
|
|||
table = document.getElementById("tableList"); |
|||
tr = $("[name='lignesPlayer']"); |
|||
// Loop through all table rows, and hide those who don't match the search query |
|||
for (i = 0; i < tr.length; i++) { |
|||
td = tr[i].getElementsByTagName("td")[3]; |
|||
if (td) { |
|||
if (td.innerHTML > actual) { |
|||
tr[i].classList.remove('normal'); |
|||
tr[i].classList.add("freeAgentGreen"); |
|||
} else if (td.innerHTML == actual) { |
|||
tr[i].classList.remove('normal'); |
|||
tr[i].classList.add("freeAgentOrange"); |
|||
} else if (td.innerHTML < actual) { |
|||
tr[i].classList.remove('normal'); |
|||
tr[i].classList.add("freeAgentRed"); |
|||
} |
|||
} |
|||
} |
|||
|
|||
table = document.getElementById("tTrade"); |
|||
tr = $("[name='lignesResults']"); |
|||
// Loop through all table rows, and hide those who don't match the search query |
|||
for (i = 0; i < tr.length; i++) { |
|||
td = tr[i].getElementsByTagName("td")[3]; |
|||
td2 = tr[i].getElementsByTagName("td")[0]; |
|||
if (td) { |
|||
if (td2.innerHTML.indexOf("*") > -1) { |
|||
tr[i].classList.remove('tab'); |
|||
tr[i].classList.add("freeAgentInjured"); |
|||
} else if (td.innerHTML > actual) { |
|||
tr[i].classList.remove('tab'); |
|||
tr[i].classList.add("freeAgentGreen"); |
|||
} else if (td.innerHTML == actual) { |
|||
tr[i].classList.remove('tab'); |
|||
tr[i].classList.add("freeAgentOrange"); |
|||
} else if (td.innerHTML < actual) { |
|||
tr[i].classList.remove('tab'); |
|||
tr[i].classList.add("freeAgentRed"); |
|||
} |
|||
} |
|||
} */ |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
var sort = $("[title='filter']"); |
|||
$(sort).each(function(col) { |
|||
$(this).hover( |
|||
function() { $(this).addClass('focus'); }, |
|||
function() { $(this).removeClass('focus'); } |
|||
); |
|||
|
|||
if($(this).text()=="RK-P"){ |
|||
$(this).addClass('desc selected'); |
|||
}; |
|||
|
|||
$(this).click(function() { |
|||
if ($(this).is('.desc')) { |
|||
$(this).removeClass('desc'); |
|||
$(this).addClass('asc selected'); |
|||
sortOrder = 1; |
|||
} |
|||
else { |
|||
$(this).addClass('desc selected'); |
|||
$(this).removeClass('asc'); |
|||
sortOrder = -1; |
|||
} |
|||
$(this).siblings().removeClass('asc selected'); |
|||
$(this).siblings().removeClass('desc selected'); |
|||
|
|||
var arrData = $('table').find("tr[name='lignesResults']"); |
|||
/* var arrData = $('table').find('tbody:nth-of-type(2) > tr').get(); */ |
|||
|
|||
arrData.sort(function(a, b) { |
|||
var val1 = $(a).children('td').eq(col).text().replace("+","").toUpperCase(); |
|||
var val2 = $(b).children('td').eq(col).text().replace("+","").toUpperCase(); |
|||
if($.isNumeric(val1) && $.isNumeric(val2)) |
|||
return sortOrder == 1 ? val1-val2 : val2-val1; |
|||
else |
|||
return (val1 < val2) ? -sortOrder : (val1 > val2) ? sortOrder : 0; |
|||
}); |
|||
|
|||
|
|||
$.each(arrData, function(index, row) { |
|||
$('tbody:nth-of-type(3)').append(row); |
|||
}); |
|||
}); |
|||
}); |
|||
|
|||
$("#everything-wrapper").fadeIn("fast"); |
|||
}); |
|||
//}); |
|||
|
|||
|
|||
|
|||
function filterName(){ |
|||
// Declare variables |
|||
var input, filter, table, tr, td, i; |
|||
input = document.getElementById("myInput"); |
|||
filter = input.value.toUpperCase(); |
|||
table = document.getElementById("tTrade"); |
|||
tr = $("[name='lignesResults']"); |
|||
|
|||
// Loop through all table rows, and hide those who don't match the search query |
|||
for (i = 0; i < tr.length; i++) { |
|||
td = tr[i].getElementsByTagName("td")[0]; |
|||
if (td) { |
|||
if (td.innerHTML.toUpperCase().indexOf(filter) > -1) { |
|||
tr[i].style.display = ""; |
|||
} else { |
|||
tr[i].style.display = "none"; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
function filterResults(Search) |
|||
{ |
|||
// Declare variables |
|||
var input, filter, table, tr, td, i; |
|||
table = document.getElementById("tTrade"); |
|||
tr = $("[name='lignesResults']"); |
|||
|
|||
// Loop through all table rows, and hide those who don't match the search query |
|||
for (i = 0; i < tr.length; i++) { |
|||
td = tr[i].getElementsByTagName("td")[0]; |
|||
if (td) { |
|||
if (td.innerHTML.toUpperCase().indexOf(Search) > -1) { |
|||
tr[i].style.display = ""; |
|||
} else { |
|||
tr[i].style.display = "none"; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
function callfilterResults(Elem) { |
|||
|
|||
var player = $("[name='player']"); |
|||
|
|||
$.ajax( |
|||
{ |
|||
url:'teamServlet', |
|||
type:'post', |
|||
data: {teamId:'${team1.code}', playerId: $(Elem).index() , action: 'faDiv'}, |
|||
success:function(response) |
|||
{ |
|||
$("#fa_div").html(response); |
|||
} |
|||
}); |
|||
|
|||
} |
|||
|
|||
|
|||
function listDiff(Elem) |
|||
{ |
|||
var drop = '${player.nom}'; |
|||
var get = $(Elem).find("td[name='get']"); |
|||
var actualPlayers = $("[name='actualPlayers']"); |
|||
var tradePlayers = $("[name='tradePlayers']"); |
|||
var cat = $("[name='cat']"); |
|||
var actualProj = $("[name='actualProj']"); |
|||
var tradeProj = $("[name='tradeProj']"); |
|||
var diff = $("[name='diff']") |
|||
var tradeProjSel = $(Elem).find("td[name='tradeProjSel']"); |
|||
|
|||
$(actualPlayers).eq(0).text(drop); |
|||
$(tradePlayers).eq(0).text($(get).eq(0).text()); |
|||
|
|||
for (x=0;x<$(cat).size();x++){ |
|||
|
|||
if($(cat).eq(x).text().includes('/')){ |
|||
var decomp = $(tradeProjSel).eq(x).text().split("/"); |
|||
var decomp2 = $(actualProj).eq(x).text().split("/"); |
|||
$(tradeProj).eq(x).text(parseFloat(decomp[0]).toFixed(0) + "/" + parseFloat(decomp[1]).toFixed(0)); |
|||
var valProj1 = parseFloat(decomp[0]) - parseFloat(decomp2[0]); |
|||
var valProj2 = parseFloat(decomp[1]) - parseFloat(decomp2[1]); |
|||
$(diff).eq(x).text(valProj1.toFixed(0) + "/" + valProj2.toFixed(0));//remaining points |
|||
}else if($(cat).eq(x).text().includes('%')){ |
|||
$(tradeProj).eq(x).text(parseFloat($(tradeProjSel).eq(x).text()).toFixed(2)); |
|||
var n = (parseFloat($(tradeProj).eq(x).text()) - parseFloat($(actualProj).eq(x).text())).toFixed(2); |
|||
changeStyle(diff,n); |
|||
}else if($(cat).eq(x).text().includes('TO')){ |
|||
$(tradeProj).eq(x).text(parseFloat($(tradeProjSel).eq(x).text())); |
|||
var n = ""+(parseFloat($(actualProj).eq(x).text()) - parseFloat($(tradeProj).eq(x).text())); |
|||
if(n>0){ |
|||
$(diff).eq(x).text(n); |
|||
$(diff).eq(x).removeClass("positive neutral").addClass("negative"); |
|||
}else if(n==0){ |
|||
$(diff).eq(x).text(n); |
|||
$(diff).eq(x).removeClass("positive negative").addClass("neutral"); |
|||
}else{ |
|||
$(diff).eq(x).text(n); |
|||
$(diff).eq(x).removeClass("negative neutral").addClass("positive"); |
|||
} |
|||
}else{ |
|||
$(tradeProj).eq(x).text(parseFloat($(tradeProjSel).eq(x).text())); |
|||
//inverse diff si col RK |
|||
if($(cat).eq(x).text() == 'Pot RK'){ |
|||
var n = ""+(parseFloat($(actualProj).eq(x).text()) - parseFloat($(tradeProj).eq(x).text())); |
|||
changeStyle(diff,n); |
|||
}else{ |
|||
var n = parseFloat($(tradeProj).eq(x).text()) - parseFloat($(actualProj).eq(x).text()); |
|||
changeStyle(diff,n); |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
function changeStyle(diff,n) |
|||
{ |
|||
if(n>0){ |
|||
$(diff).eq(x).text("+" + n); |
|||
$(diff).eq(x).removeClass("negative neutral").addClass("positive"); |
|||
}else if(n==0){ |
|||
$(diff).eq(x).text(n); |
|||
$(diff).eq(x).removeClass("positive negative").addClass("neutral"); |
|||
}else{ |
|||
$(diff).eq(x).text(n); |
|||
$(diff).eq(x).removeClass("positive neutral").addClass("negative"); |
|||
} |
|||
} |
|||
|
|||
function makeTableScroll() { |
|||
|
|||
var maxRows = 25; |
|||
var tablebody = document.getElementById('tTrade'); |
|||
var rowsInTable = tablebody.rows.length; |
|||
var height = 0; |
|||
if (rowsInTable > maxRows) { |
|||
for (var i = 0; i < maxRows; i++) { |
|||
height += tablebody.rows[i].clientHeight; |
|||
} |
|||
tablebody.style.height = height + "px"; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
</script> |
|||
|
|||
</head> |
|||
<body onload="makeTableScroll()"> |
|||
|
|||
<c:set var="players" value="${requestScope.playerList}" /> |
|||
<c:set var="teamID" value="${requestScope.teamID}" /> |
|||
|
|||
<c:set var="mainFA" value="${requestScope.mainFA}" /> |
|||
<c:set var="stats" value="${requestScope.statBase}" /> |
|||
<c:set var="team1" value="${requestScope.team1}" /> |
|||
<c:set var="team1Stats" value="${requestScope.team1Stats}" /> |
|||
<c:set var="otherTeamStats" value="${requestScope.otherTeamStats}" /> |
|||
<c:set var="nbTeam" value="${requestScope.nbTeam}" /> |
|||
|
|||
<h1 align='center'>Find Free Agents</h1> |
|||
|
|||
<!-- <div style="width: 100%;text-align: center;"> |
|||
<input type="submit" value="test fa" onclick="listFA();"/> |
|||
</div> --> |
|||
|
|||
|
|||
<div id="everything-wrapper" style="width: 100%;text-align: center;"> |
|||
|
|||
<div style="display: inline-block;vertical-align:top;width:275px;" > |
|||
|
|||
<table class="tableTrade"> |
|||
<thead> |
|||
<tr class="Header"> |
|||
<th colspan="2" ><c:out value="TEAM" /></th> |
|||
<th name="actualRK"><c:out value="Proj RK" /></th> |
|||
<th name="actualPTS"><c:out value="Proj PTS" /></th> |
|||
</tr> |
|||
</thead> |
|||
<tr class="ligneHead"> |
|||
<th colspan="2"><c:out value="${team1.name}" /></th> |
|||
<th name="actualRK"><fmt:formatNumber pattern="0.#" value="${team1.projRK}" /></th> |
|||
<th name="actualPTS"><fmt:formatNumber pattern="0.#" value="${team1.projTot}" /></th> |
|||
</tr> |
|||
|
|||
<thead> |
|||
<tr class="Header"> |
|||
<th><c:out value="Player RK" /></th> |
|||
<th align="left"><c:out value="Player" /></th> |
|||
<th ><c:out value="Pot RK" /></th> |
|||
<th ><c:out value="Pot PTS" /></th> |
|||
</tr> |
|||
|
|||
</thead> |
|||
<tbody > |
|||
<c:forEach var="player" items= "${players}" varStatus="i"> |
|||
<tr name="lignesPlayer" class="tab" id="${i.index}" onclick="return callfilterResults(this);"> |
|||
<td align="center"><fmt:formatNumber pattern="0.#" value="${player.interRK}" /></td> |
|||
<td align="left" name ="player"><c:out value="${player.nom}" /></td> |
|||
<td name="potRKcell" ><fmt:formatNumber pattern="0.#" value="${player.potRK}" /></td> |
|||
<td name="potPTScell" ><fmt:formatNumber pattern="0.#" value="${player.potPoint}" /></td> |
|||
</tr> |
|||
</c:forEach> |
|||
</tbody> |
|||
</table> |
|||
|
|||
<input type="text" id="myInput" onkeyup="filterName()" placeholder="Search for names.."> |
|||
|
|||
</div> |
|||
|
|||
<div id="fa_div" style="display: inline-block;vertical-align:top"> |
|||
|
|||
<table class="tableTrade"> |
|||
<thead > |
|||
<!---------------------- TAB HEADER-------------------------------> |
|||
<tr class="Header" > |
|||
<th name="statTab" colspan="${fn:length(team1Stats)+1}"><c:out value="Waiver impact" /></th> |
|||
<th name="teamTab" colspan="${nbTeam - 1}"><c:out value="Impact on other teams" /></th> |
|||
</tr> |
|||
<!----------------------------------------- STATS CAT ----------------> |
|||
<tr name="headers" class="Header" > |
|||
<th align="left" ><c:out value="Drop" /></th> |
|||
<th ><c:out value="Pot RK" /></th> |
|||
<c:forEach var="stat" items= "${stats}" > |
|||
<c:if test="${!fn:contains(stat.name,'/')}"> |
|||
<th ><c:out value="${fn:replace(stat.name,'Team ','')}" /></th> |
|||
</c:if> |
|||
</c:forEach> |
|||
</tr> |
|||
</thead> |
|||
<!------------------------------- LIGNE ACTUAL STATS PROJECTION--> |
|||
<tbody > |
|||
<tr name="headers" class="ligneHead" > |
|||
<c:forEach var="stat" items= "${team1Stats}" varStatus="i"> |
|||
<c:if test="${i.first}"> |
|||
<th name="actualPlayers">Actual Projection</th> |
|||
<th name="actualProj"><fmt:formatNumber pattern="0.#" value="${team1projectedRK}" /></th> |
|||
<th name="actualProj"><fmt:formatNumber pattern="0.#" value="${team1projTot}" /></th> |
|||
</c:if> |
|||
<c:if test="${!fn:contains(stat.name,'/')}"> |
|||
<th name="actualProj"><c:out value="${stat.valProjection}" /></th> |
|||
</c:if> |
|||
</c:forEach> |
|||
|
|||
<c:forEach var="stat" items= "${otherTeamStats}" > |
|||
<th name="actualProj"><c:out value="${stat}" /></th> |
|||
</c:forEach> |
|||
</tr> |
|||
|
|||
<!-- LIGNE WITH FA STATS PROJECTION--> |
|||
<tr name="headers" class="ligneHead" > |
|||
<c:forEach var="stat" items= "${stats}" varStatus="i"> |
|||
<c:if test="${stat.name == 'RK-P'}"> |
|||
<th name="tradePlayers" >Proj with FA</th> |
|||
<th name="tradeProj"><c:out value="--" /></th> |
|||
</c:if> |
|||
|
|||
<c:if test="${!stat.name.contains('/')}"> |
|||
<th name="tradeProj"><c:out value="--" /></th> |
|||
</c:if> |
|||
|
|||
</c:forEach> |
|||
</tr> |
|||
|
|||
<!------------- LIGNE DIFFERENCES -----> |
|||
<tr name="headers" class="ligneHead" > |
|||
<c:forEach var="stat" items= "${stats}" varStatus="i"> |
|||
<c:if test="${stat.name == 'RK-P'}"> |
|||
<th >Difference</th> |
|||
<th id="diff" name="diff"><c:out value="--" /></th> |
|||
</c:if> |
|||
|
|||
<c:if test="${!stat.name.contains('/')}"> |
|||
<th id="diff" name="diff"><c:out value="--" /></th> |
|||
</c:if> |
|||
|
|||
</c:forEach> |
|||
</tr> |
|||
|
|||
</tbody> |
|||
|
|||
<thead > |
|||
<!----------------------------------------- STATS CAT ----------------> |
|||
<tr name="headers" class="Header" > |
|||
<th align="left" title="filter"><c:out value="Waiver" /></th> |
|||
<th name="cat" title="filter"><c:out value="Pot RK" /></th> |
|||
<c:forEach var="stat" items= "${stats}" > |
|||
<c:if test="${!fn:contains(stat.name,'/')}"> |
|||
<th name="cat" title="filter"><c:out value="${fn:replace(stat.name,'Team ','')}" /></th> |
|||
</c:if> |
|||
</c:forEach> |
|||
</tr> |
|||
</thead> |
|||
<!------------------------ START RESULT TAB--------------------------------> |
|||
|
|||
<tbody id="tTrade" style="overflow-y: scroll;overflow-x: hidden;" > |
|||
<c:forEach var="fa" items= "${mainFA}" > |
|||
|
|||
<tr name="lignesResults" class="tab" id="${i.index}" onclick="return listDiff(this);"> |
|||
|
|||
<c:forEach var="stat" items= "${fa}" varStatus="i" > |
|||
|
|||
<c:if test="${i.first}"> |
|||
<td align="left" name="get"><c:out value="${stat.player}" /></td> |
|||
<td name="tradeProjSel"><fmt:formatNumber pattern="0.#" value="${stat.projectedRK}" /></td> |
|||
</c:if> |
|||
<c:if test="${!fn:contains(stat.name,'/')}"> |
|||
<c:if test="${!fn:contains(stat.name,'%')}"> |
|||
<td name="tradeProjSel" align="center"><fmt:formatNumber pattern="0.#" value="${stat.valProjection}" /></td> |
|||
</c:if> |
|||
<c:if test="${fn:contains(stat.name,'%')}"> |
|||
<td name="tradeProjSel" align="center"><fmt:formatNumber pattern="0.00" value="${stat.valProjection}" /></td> |
|||
</c:if> |
|||
</c:if> |
|||
|
|||
</c:forEach> |
|||
|
|||
</tr> |
|||
|
|||
</c:forEach> |
|||
</tbody> |
|||
</table> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
</body> |
|||
</html> |
|||
|
|||
|
|||
|
|||
@ -0,0 +1,185 @@ |
|||
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" |
|||
pageEncoding="ISO-8859-1"%> |
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
|||
<link href="${pageContext.request.contextPath}/CSS/style.css" rel="stylesheet" type="text/css" > |
|||
|
|||
<title>trade</title> |
|||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> |
|||
|
|||
|
|||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> |
|||
<script type="text/javascript"> |
|||
|
|||
$(document).ready(function() { |
|||
$('#drop1').val(6); |
|||
listTeam('drop1','team1_div','team2_div',true) |
|||
|
|||
|
|||
|
|||
}); //end doc ready |
|||
|
|||
|
|||
function listTeam(Elem, Div, otherDiv, first) |
|||
{ |
|||
var selT = document.getElementsByName(Elem)[0].value; |
|||
|
|||
if (Elem == 'drop1'){ |
|||
//desactive l entree dans la liste 2 |
|||
$("#drop2 > option").each(function() { |
|||
this.removeAttribute("disabled"); |
|||
if(this.value == selT){ |
|||
this.setAttribute("disabled", "disabled"); |
|||
} |
|||
}); |
|||
var othT = $('#drop2 option:selected').val(); |
|||
}else{ |
|||
//desactive l entree dans la liste 1 |
|||
$("#drop1 > option").each(function() { |
|||
this.removeAttribute("disabled"); |
|||
if(this.value == selT){ |
|||
this.setAttribute("disabled", "disabled"); |
|||
} |
|||
}); |
|||
var othT = $('#drop1 option:selected').val(); |
|||
} |
|||
|
|||
$.ajax( |
|||
{ |
|||
url:'CALL_DIV_team', |
|||
type:'get', |
|||
data: {selectedT: selT, otherT: othT, tableName: Div, otherTableName: otherDiv}, |
|||
success:function(response) |
|||
{ |
|||
$("#"+Div).html(response); |
|||
} |
|||
}); |
|||
|
|||
if(Elem == 'drop2' && first){ |
|||
listTeam('drop1','team1_div','team2_div',false) |
|||
} |
|||
else if(Elem == 'drop1' && first){ |
|||
listTeam('drop2','team2_div','team1_div',false) |
|||
} |
|||
|
|||
} |
|||
|
|||
function listTrade() |
|||
{ |
|||
|
|||
//$("#divTeams").fadeOut(); |
|||
$("#divTrade").fadeIn(); |
|||
|
|||
//$("#btnList").fadeOut(); |
|||
|
|||
|
|||
var T1 = document.getElementById('drop1').value; |
|||
var T2 = document.getElementById('drop2').value; |
|||
|
|||
stringSelT1 = ""; |
|||
$("#team1_div tr.selected").each(function() { |
|||
stringSelT1 += $(this).attr("player") +","; |
|||
}); |
|||
stringSelT2 = ""; |
|||
$("#team2_div tr.selected").each(function() { |
|||
stringSelT2 += $(this).attr("player") +","; |
|||
}); |
|||
|
|||
$.ajax( |
|||
{ |
|||
url:'DIV_trade', |
|||
type:'get', |
|||
data: {team1: T1 , team2: T2 , selTeam1: stringSelT1 , selTeam2: stringSelT2}, |
|||
success:function(response) |
|||
{ |
|||
$("#trade_div").html(response); |
|||
//$("#btnTrade").fadeIn(); |
|||
} |
|||
}); |
|||
|
|||
|
|||
} |
|||
function chooseTrade() |
|||
{ |
|||
//$("#divTeams").fadeIn(); |
|||
//$("#btnList").fadeIn(); |
|||
//$("#divTrade").fadeOut(); |
|||
//$("#btnTrade").fadeOut(); |
|||
} |
|||
</script> |
|||
|
|||
</head> |
|||
<body> |
|||
|
|||
<c:set var="teams" value="${requestScope.teamList}" /> |
|||
|
|||
<div class="wrapper"> |
|||
<header class="main-head"> |
|||
<c:out value="Trade Analyser" /> |
|||
<div style="width: 100%;text-align: center;margin-bottom:10px;"> |
|||
<div id="btnList" style="display: inline-block;vertical-align:top;"> |
|||
<input type="submit" value="Test trade" onclick="listTrade();"/> |
|||
</div> |
|||
<div id="btnTrade" style="display: inline-block;vertical-align:top;display: none;"> |
|||
<input type="submit" value="Select Trade" onclick="chooseTrade();"/> |
|||
</div> |
|||
</div> |
|||
</header> |
|||
|
|||
<!-- <nav class="main-nav"> |
|||
<ul> |
|||
<li><a href="">Nav 1</a></li> |
|||
<li><a href="">Nav 2</a></li> |
|||
<li><a href="">Nav 3</a></li> |
|||
</ul> |
|||
</nav> |
|||
--> |
|||
|
|||
<article class="team"> |
|||
<ul class="listingTeam"> |
|||
<li id="divTeams1"> |
|||
<Select id="drop1" name="drop1" onchange="return listTeam('drop1','team1_div','team2_div',true);"> |
|||
<c:forEach var="team" items= "${teams}" varStatus="i"> |
|||
<Option value="${i.index}">${team.name}</ Option> |
|||
</c:forEach> |
|||
</select> |
|||
<div id="team1_div"></div> |
|||
</li> |
|||
|
|||
<li id="divTeams2"> |
|||
<Select id="drop2" name="drop2" onchange="return listTeam('drop2','team2_div','team1_div',true);"> |
|||
<c:forEach var="team" items= "${teams}" varStatus="i"> |
|||
<Option value="${i.index}">${team.name}</ Option> |
|||
</c:forEach> |
|||
</select> |
|||
<div id="team2_div"></div> |
|||
</li> |
|||
|
|||
<li class="wide" id="divTrade" style="display: none;"> |
|||
<div class="cn"> |
|||
<div id="loader" style="width: 100%;text-align: center;margin-top: 15px"> |
|||
<span><c:out value="Calculating best trades" /></span> |
|||
<span class="l-1"></span> |
|||
<span class="l-2"></span> |
|||
<span class="l-3"></span> |
|||
<span class="l-4"></span> |
|||
<span class="l-5"></span> |
|||
<span class="l-6"></span> |
|||
</div> |
|||
</div> |
|||
<div id="trade_div"></div> |
|||
|
|||
</li> |
|||
</ul> |
|||
</article> |
|||
<footer class="main-footer">The footer</footer> |
|||
</div> |
|||
|
|||
|
|||
|
|||
</body> |
|||
</html> |
|||
|
|||
|
|||
|
After Width: | Height: | Size: 28 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 174 B |
|
After Width: | Height: | Size: 1.3 KiB |
@ -0,0 +1 @@ |
|||
!function(s){"use strict";s.fn.selectedrows=function(){var t,e=s(this[0]);if("TABLE"===e.prop("tagName").toUpperCase()&&void 0!==e.attr("data-rs-selectable")){var a=e.attr("data-rs-class")||"selected";t=s(e).find("tbody tr."+a)}return t}}(jQuery),$(document).ready(function(){"use strict";var s={};$("body").on("mouseover","table[data-rs-selectable]",function(){$(this).addClass("unselectable").attr("unselectable","on")}),$("body").on("click","table[data-rs-selectable] tr",function(t){var e=$(this),a=e.closest("table"),r=a.attr("data-rs-type")||"many",l=a.attr("data-rs-class")||"selected";if("none"!==r)if("one"===r)$(this).siblings().removeClass(l).end().addClass(l);else if($(this).toggleClass(l),t.shiftKey){var i=s[a.id]||!1;if(i&&this!==i&&$(this).hasClass(l)===$(i).hasClass(l))for(var n=this.rowIndex>i.rowIndex?i:this,d=this.rowIndex>i.rowIndex?this:i,o=$(this).hasClass(l),c=$(n).nextAll("tr"),h=0,f=c.length;f>h&&c[h]!==d;h+=1)o?$(c[h]).addClass(l):$(c[h]).removeClass(l)}s[a.id]=this,$(a).trigger("clicked.rs.row")})}); |
|||
Binary file not shown.
Binary file not shown.
@ -0,0 +1,25 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1"> |
|||
<display-name>FantasyManager</display-name> |
|||
<welcome-file-list> |
|||
|
|||
<welcome-file>index.jsp</welcome-file><welcome-file>index.html</welcome-file><welcome-file>index.htm</welcome-file> |
|||
|
|||
<welcome-file>default.html</welcome-file> |
|||
<welcome-file>default.htm</welcome-file> |
|||
<welcome-file>default.jsp</welcome-file> |
|||
</welcome-file-list> |
|||
<servlet> |
|||
<description></description> |
|||
<display-name>FreeAgent</display-name> |
|||
<servlet-name>FreeAgent</servlet-name> |
|||
<servlet-class>test.serv.Team</servlet-class> |
|||
</servlet> |
|||
<servlet-mapping> |
|||
<servlet-name>FreeAgent</servlet-name> |
|||
<url-pattern>/FreeAgent</url-pattern> |
|||
</servlet-mapping> |
|||
|
|||
|
|||
|
|||
</web-app> |
|||
@ -0,0 +1,57 @@ |
|||
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" |
|||
pageEncoding="ISO-8859-1"%> |
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
|||
|
|||
|
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
|||
<link href="${pageContext.request.contextPath}/CSS/style.css" rel="stylesheet" type="text/css" > |
|||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> |
|||
|
|||
<script type="text/javascript"> |
|||
|
|||
|
|||
function showHide() { |
|||
$('#loader').show(); |
|||
} |
|||
|
|||
</script> |
|||
|
|||
<title>league</title> |
|||
</head> |
|||
|
|||
|
|||
<body> |
|||
|
|||
<h1 align='center'>Choose League</h1> |
|||
|
|||
<div style="width: 100%;text-align: center;"> |
|||
|
|||
<div style="display: inline-block;"> |
|||
|
|||
<form id='loginForm' name='loginForm' method='post' action='fantasyServlet' onsubmit="showHide()"> |
|||
Year : <br/> |
|||
<input style="text-align: center;" type='text' name='year' value='2019'/> <br/> |
|||
League ID : <br/> |
|||
<input style="text-align: center;" type='text' name='league' value='209346' /> <br/> |
|||
<br/> |
|||
<input type='submit' value='Enter' /></form> |
|||
</div> |
|||
<br/> |
|||
<img style="width:250px;height:250px;" src="${pageContext.request.contextPath}/PICS/Fantasy-Basketball-badge.png" alt = "NBA Fantasy" /> |
|||
|
|||
</div> |
|||
|
|||
<div id="loader" style= "width: 100%;text-align: center;display:none;"> |
|||
<span>Importing Teams</span> |
|||
<span class="l-1"></span> |
|||
<span class="l-2"></span> |
|||
<span class="l-3"></span> |
|||
<span class="l-4"></span> |
|||
<span class="l-5"></span> |
|||
<span class="l-6"></span> |
|||
</div> |
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,108 @@ |
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
<groupId>Final</groupId> |
|||
<artifactId>Final</artifactId> |
|||
<version>0.0.1-SNAPSHOT</version> |
|||
<packaging>war</packaging> |
|||
<build> |
|||
<sourceDirectory>src</sourceDirectory> |
|||
<plugins> |
|||
<plugin> |
|||
<artifactId>maven-compiler-plugin</artifactId> |
|||
<version>3.7.0</version> |
|||
<configuration> |
|||
<release>9</release> |
|||
</configuration> |
|||
</plugin> |
|||
<plugin> |
|||
<artifactId>maven-war-plugin</artifactId> |
|||
<version>3.0.0</version> |
|||
<configuration> |
|||
<warSourceDirectory>WebContent</warSourceDirectory> |
|||
</configuration> |
|||
</plugin> |
|||
</plugins> |
|||
</build> |
|||
|
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>com.google.visualization</groupId> |
|||
<artifactId>visualization-datasource</artifactId> |
|||
<version>1.1.1</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.fasterxml.jackson.core</groupId> |
|||
<artifactId>jackson-core</artifactId> |
|||
<version>2.9.2</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>com.fasterxml.jackson.core</groupId> |
|||
<artifactId>jackson-annotations</artifactId> |
|||
<version>2.9.2</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>com.fasterxml.jackson.core</groupId> |
|||
<artifactId>jackson-databind</artifactId> |
|||
<version>2.9.2</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.jsoup</groupId> |
|||
<artifactId>jsoup</artifactId> |
|||
<version>1.9.1</version> |
|||
</dependency> |
|||
|
|||
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson --> |
|||
<dependency> |
|||
<groupId>com.google.code.gson</groupId> |
|||
<artifactId>gson</artifactId> |
|||
<version>2.8.1</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>mysql</groupId> |
|||
<artifactId>mysql-connector-java</artifactId> |
|||
<version>6.0.6</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>io.webfolder</groupId> |
|||
<artifactId>ui4j-webkit</artifactId> |
|||
<version>3.1.0</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>org.seleniumhq.selenium</groupId> |
|||
<artifactId>selenium-server</artifactId> |
|||
<version>3.4.0</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>org.seleniumhq.selenium</groupId> |
|||
<artifactId>selenium-firefox-driver</artifactId> |
|||
<version>3.4.0</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>javax.servlet</groupId> |
|||
<artifactId>javax.servlet-api</artifactId> |
|||
<version>3.0.1</version> |
|||
<scope>provided</scope> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>com.google.guava</groupId> |
|||
<artifactId>guava</artifactId> |
|||
<version>21.0</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>com.codeborne</groupId> |
|||
<artifactId>phantomjsdriver</artifactId> |
|||
<version>1.4.1</version> |
|||
</dependency> |
|||
|
|||
|
|||
</dependencies> |
|||
|
|||
</project> |
|||
@ -0,0 +1,64 @@ |
|||
package call_content; |
|||
|
|||
import java.io.IOException; |
|||
import java.io.PrintWriter; |
|||
|
|||
import javax.servlet.RequestDispatcher; |
|||
import javax.servlet.ServletException; |
|||
import javax.servlet.annotation.WebServlet; |
|||
import javax.servlet.http.HttpServlet; |
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
|
|||
import com.fasterxml.jackson.core.JsonFactory; |
|||
import com.fasterxml.jackson.databind.JsonNode; |
|||
import com.fasterxml.jackson.databind.ObjectMapper; |
|||
import com.google.visualization.datasource.datatable.DataTable; |
|||
import com.google.visualization.datasource.render.JsonRenderer; |
|||
|
|||
import functions.GRAPH_rebuild; |
|||
import jsoupImport.ImportLineups; |
|||
|
|||
|
|||
/** |
|||
* Servlet implementation class FreeAgent |
|||
*/ |
|||
@WebServlet("/CALL_Rebuild" ) |
|||
public class CALL_Rebuild extends HttpServlet { |
|||
private static final long serialVersionUID = 1L; |
|||
public static float maxVal=0; |
|||
public static float lowVal=100; |
|||
public static DataTable data; |
|||
/** |
|||
* @see HttpServlet#HttpServlet() |
|||
*/ |
|||
public CALL_Rebuild() { |
|||
super(); |
|||
// TODO Auto-generated constructor stub
|
|||
} |
|||
/** |
|||
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) |
|||
*/ |
|||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { |
|||
// TODO Auto-generated method stub
|
|||
} |
|||
|
|||
/** |
|||
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) |
|||
*/ |
|||
//appelé lors du clic test fa
|
|||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { |
|||
|
|||
try { |
|||
|
|||
new ImportLineups(); |
|||
new GRAPH_rebuild(); |
|||
|
|||
} catch (Exception e) { |
|||
// TODO Auto-generated catch block
|
|||
e.printStackTrace(); |
|||
} |
|||
|
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,132 @@ |
|||
package call_content; |
|||
|
|||
import java.io.IOException; |
|||
import java.io.PrintWriter; |
|||
|
|||
import javax.servlet.RequestDispatcher; |
|||
import javax.servlet.ServletException; |
|||
import javax.servlet.annotation.WebServlet; |
|||
import javax.servlet.http.HttpServlet; |
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
|
|||
import com.fasterxml.jackson.core.JsonFactory; |
|||
import com.fasterxml.jackson.databind.JsonNode; |
|||
import com.fasterxml.jackson.databind.ObjectMapper; |
|||
import com.google.visualization.datasource.datatable.DataTable; |
|||
import com.google.visualization.datasource.render.JsonRenderer; |
|||
|
|||
import functions.GRAPH_init; |
|||
|
|||
|
|||
/** |
|||
* Servlet implementation class FreeAgent |
|||
*/ |
|||
@WebServlet("/GRAPH_CALL" ) |
|||
public class GRAPH_CALL extends HttpServlet { |
|||
private static final long serialVersionUID = 1L; |
|||
public static float maxVal=0; |
|||
public static float lowVal=100; |
|||
public static DataTable data; |
|||
/** |
|||
* @see HttpServlet#HttpServlet() |
|||
*/ |
|||
public GRAPH_CALL() { |
|||
super(); |
|||
// TODO Auto-generated constructor stub
|
|||
} |
|||
|
|||
/** |
|||
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) |
|||
*/ |
|||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { |
|||
// TODO Auto-generated method stub
|
|||
PrintWriter out = response.getWriter(); |
|||
|
|||
JsonNode root = null; |
|||
String json = JsonRenderer.renderDataTable(data, true, false).toString(); |
|||
|
|||
try{ |
|||
com.fasterxml.jackson.core.JsonParser parser = new JsonFactory().createJsonParser(json); |
|||
root = new ObjectMapper().readTree(parser); |
|||
}catch(Exception e){ |
|||
e.printStackTrace(); |
|||
} |
|||
|
|||
response.setContentType("application/json"); |
|||
|
|||
out.println(root.toString()); |
|||
|
|||
} |
|||
|
|||
/** |
|||
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) |
|||
*/ |
|||
//appelé lors du clic test fa
|
|||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { |
|||
|
|||
|
|||
PrintWriter out = response.getWriter(); |
|||
|
|||
int width = 0; |
|||
int height = 0; |
|||
String title =""; |
|||
String divGraph =""; |
|||
String legPos =""; |
|||
int heightPour = 0; |
|||
int widthPour = 0 ; |
|||
int left = 0; |
|||
int top = 0; |
|||
int direc; |
|||
String typeGraph = request.getParameter("typeGraph"); |
|||
|
|||
data = new GRAPH_init().data(typeGraph); |
|||
|
|||
|
|||
if(typeGraph.equals("mainGraph")) { |
|||
width = 710; |
|||
height = 295; |
|||
title = ""; |
|||
left = 50 ; |
|||
top = 10; |
|||
divGraph = "chart_div"; |
|||
legPos = "right"; |
|||
heightPour = 90; |
|||
widthPour = 70; |
|||
direc = 1; |
|||
}else { |
|||
width = 350; |
|||
height = 200; |
|||
title = ""; |
|||
left = 35 ; |
|||
top = 10; |
|||
divGraph = typeGraph; |
|||
legPos = "none"; |
|||
heightPour = 90; |
|||
widthPour = 90; |
|||
if(typeGraph.equals("TO")) { |
|||
direc = -1; |
|||
}else { |
|||
direc = 1; |
|||
} |
|||
} |
|||
|
|||
request.setAttribute("divGraph", divGraph); |
|||
request.setAttribute("maxVal", maxVal); |
|||
request.setAttribute("lowVal", lowVal); |
|||
request.setAttribute("width", width); |
|||
request.setAttribute("height", height); |
|||
request.setAttribute("title", title); |
|||
request.setAttribute("left", left); |
|||
request.setAttribute("top", top); |
|||
request.setAttribute("legPos", legPos); |
|||
request.setAttribute("direc", direc); |
|||
request.setAttribute("heightPour", heightPour); |
|||
request.setAttribute("widthPour", widthPour); |
|||
|
|||
RequestDispatcher rd = getServletContext().getRequestDispatcher("/DIV_graph.jsp"); |
|||
rd.forward(request, response); |
|||
|
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,63 @@ |
|||
package call_divs; |
|||
|
|||
import java.io.IOException; |
|||
import java.util.ArrayList; |
|||
import java.util.HashMap; |
|||
import java.util.Map; |
|||
|
|||
import javax.servlet.RequestDispatcher; |
|||
import javax.servlet.ServletException; |
|||
import javax.servlet.annotation.WebServlet; |
|||
import javax.servlet.http.HttpServlet; |
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import javax.servlet.http.HttpSession; |
|||
|
|||
import call_pages.CALL_Fantasy; |
|||
import objects.Player; |
|||
import objects.Slot; |
|||
import objects.Teams; |
|||
|
|||
/** |
|||
* Servlet implementation class FreeAgent |
|||
*/ |
|||
@WebServlet("/CALL_DIV_maxPace" ) |
|||
public class CALL_DIV_maxPace extends HttpServlet { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* @see HttpServlet#HttpServlet() |
|||
*/ |
|||
public CALL_DIV_maxPace() { |
|||
super(); |
|||
// TODO Auto-generated constructor stub
|
|||
} |
|||
|
|||
/** |
|||
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) |
|||
*/ |
|||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { |
|||
// TODO Auto-generated method stub
|
|||
|
|||
|
|||
} |
|||
|
|||
/** |
|||
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) |
|||
*/ |
|||
//appelé lors du clic test fa
|
|||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { |
|||
|
|||
|
|||
response.getWriter().append("Served at: ").append(request.getContextPath()); |
|||
response.setContentType("text/html"); |
|||
|
|||
request.setAttribute("slotList", CALL_Fantasy.l1.leagueTeams.get(0).slots); |
|||
request.setAttribute("teamList", CALL_Fantasy.l1.leagueTeams); |
|||
|
|||
RequestDispatcher rd = getServletContext().getRequestDispatcher("/DIV_maxPace.jsp"); |
|||
rd.forward(request, response); |
|||
|
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,95 @@ |
|||
package call_divs; |
|||
|
|||
import java.io.IOException; |
|||
import java.util.ArrayList; |
|||
|
|||
import javax.servlet.RequestDispatcher; |
|||
import javax.servlet.ServletException; |
|||
import javax.servlet.annotation.WebServlet; |
|||
import javax.servlet.http.HttpServlet; |
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
|
|||
import call_pages.CALL_Fantasy; |
|||
import objects.Player; |
|||
|
|||
/** |
|||
* Servlet implementation class FreeAgent |
|||
*/ |
|||
@WebServlet("/CALL_DIV_team" ) |
|||
public class CALL_DIV_team extends HttpServlet { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* @see HttpServlet#HttpServlet() |
|||
*/ |
|||
public CALL_DIV_team() { |
|||
super(); |
|||
// TODO Auto-generated constructor stub
|
|||
} |
|||
|
|||
/** |
|||
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) |
|||
*/ |
|||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { |
|||
// TODO Auto-generated method stub
|
|||
response.getWriter().append("Served at: ").append(request.getContextPath()); |
|||
|
|||
response.setContentType("text/html"); |
|||
|
|||
String team = request.getParameter("selectedT"); |
|||
int chosenT = Integer.parseInt(team); |
|||
String otherT = request.getParameter("otherT"); |
|||
int chosenO = Integer.parseInt(otherT); |
|||
|
|||
|
|||
ArrayList<Player> playersChosenT = CALL_Fantasy.l1.leagueTeams.get(chosenT).players; |
|||
ArrayList<Player> playersOtherT = CALL_Fantasy.l1.leagueTeams.get(chosenO).players; |
|||
|
|||
|
|||
//supprime les éventuels autre joueurs ajouté
|
|||
for (int x = 0; x < playersChosenT.size();x++) { |
|||
playersChosenT.get(x).inTrade = false; |
|||
if(playersChosenT.get(x).teamID != chosenT) { |
|||
System.out.println("remove " + playersChosenT.get(x).getnom() + " from " + CALL_Fantasy.l1.leagueTeams.get(chosenT).getName()); |
|||
playersChosenT.remove(x); |
|||
x-=1; |
|||
} |
|||
} |
|||
for (int x = 0; x < playersOtherT.size();x++) { |
|||
if(playersOtherT.get(x).teamID != chosenT && playersOtherT.get(x).teamID != chosenO) { |
|||
System.out.println("remove " + playersOtherT.get(x).getnom() + " from " + CALL_Fantasy.l1.leagueTeams.get(chosenO).getName()); |
|||
playersOtherT.remove(x); |
|||
x-=1; |
|||
} |
|||
} |
|||
|
|||
//ajoute les joueurs de l autre équipe
|
|||
for (int x = 0; x < playersOtherT.size();x++) { |
|||
if(playersOtherT.get(x).teamID != chosenT && !playersOtherT.get(x).inTrade) { |
|||
playersChosenT.add(playersOtherT.get(x)); |
|||
System.out.println("add " + playersOtherT.get(x).getnom() + " in " + CALL_Fantasy.l1.leagueTeams.get(chosenT).getName()); |
|||
} |
|||
} |
|||
|
|||
request.setAttribute("teamID", chosenT); |
|||
request.setAttribute("team2ID", chosenO); |
|||
request.setAttribute("Tplayers", playersChosenT); |
|||
request.setAttribute("tableName", request.getParameter("tableName")); |
|||
request.setAttribute("otherTableName", request.getParameter("otherTableName")); |
|||
|
|||
RequestDispatcher rd = getServletContext().getRequestDispatcher("/DIV_team.jsp"); |
|||
rd.forward(request, response); |
|||
|
|||
} |
|||
|
|||
/** |
|||
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) |
|||
*/ |
|||
//appelé lors du clic test fa
|
|||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { |
|||
|
|||
|
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,141 @@ |
|||
package call_divs; |
|||
|
|||
import java.io.IOException; |
|||
import java.text.DecimalFormat; |
|||
import java.util.ArrayList; |
|||
import java.util.Collections; |
|||
import java.util.Comparator; |
|||
import java.util.List; |
|||
import java.util.stream.Collectors; |
|||
import java.util.stream.Stream; |
|||
|
|||
import javax.servlet.RequestDispatcher; |
|||
import javax.servlet.ServletException; |
|||
import javax.servlet.annotation.WebServlet; |
|||
import javax.servlet.http.HttpServlet; |
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
|
|||
import call_pages.CALL_Fantasy; |
|||
import functions.FA_testPlayer; |
|||
import functions.TRADE_test; |
|||
import jsoupImport.ImportPlayerStats; |
|||
import jsoupImport.ImportPlayers; |
|||
import objects.Player; |
|||
import objects.Stat; |
|||
import objects.Teams; |
|||
|
|||
/** |
|||
* Servlet implementation class FreeAgent |
|||
*/ |
|||
@WebServlet("/DIV_trade" ) |
|||
public class CALL_DIV_trade extends HttpServlet { |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* @see HttpServlet#HttpServlet() |
|||
*/ |
|||
public CALL_DIV_trade() { |
|||
super(); |
|||
// TODO Auto-generated constructor stub
|
|||
} |
|||
|
|||
/** |
|||
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) |
|||
*/ |
|||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { |
|||
// TODO Auto-generated method stub
|
|||
response.getWriter().append("Served at: ").append(request.getContextPath()); |
|||
final DecimalFormat f = new DecimalFormat("0.#"); |
|||
final DecimalFormat in = new DecimalFormat("0.##"); |
|||
|
|||
//récupère les ID des équipes
|
|||
int T1 = Integer.parseInt(request.getParameter("team1")); |
|||
int T2 = Integer.parseInt(request.getParameter("team2")); |
|||
Teams team1 = CALL_Fantasy.l1.leagueTeams.get(T1); |
|||
Teams team2 = CALL_Fantasy.l1.leagueTeams.get(T2); |
|||
|
|||
//recupere les listes de joueurs tradé
|
|||
String stringSelT1 = request.getParameter("selTeam1"); |
|||
String stringSelT2 = request.getParameter("selTeam2"); |
|||
List<String> listP1 = |
|||
Stream.of(stringSelT1.split(",")) |
|||
.collect(Collectors.toList()); |
|||
List<String> listP2 = |
|||
Stream.of(stringSelT2.split(",")) |
|||
.collect(Collectors.toList()); |
|||
|
|||
//définit les joueurs comme InTrade
|
|||
for (int x=0 ;x<listP1.size();x++) { |
|||
for (Player PlayerX: team1.players) { |
|||
if(PlayerX.getnom().equals(listP1.get(x))) { |
|||
PlayerX.setInTrade(true); |
|||
} |
|||
} |
|||
} |
|||
for (int x=0 ;x<listP2.size();x++) { |
|||
for (Player PlayerX: team2.players) { |
|||
if(PlayerX.getnom().equals(listP2.get(x))) { |
|||
PlayerX.setInTrade(true); |
|||
} |
|||
} |
|||
} |
|||
|
|||
//appelle le SetTrade et affiche le résultat-------EXECUTE TRADE
|
|||
request.setAttribute("mainTRADE", TRADE_test.SetTrade(team1, team2)); |
|||
|
|||
//définit les joueurs comme InTrade
|
|||
for (int x=0 ;x<listP1.size();x++) { |
|||
for (Player PlayerX: team1.players) { |
|||
if(PlayerX.getnom().equals(listP1.get(x))) { |
|||
PlayerX.setInTrade(false); |
|||
} |
|||
} |
|||
} |
|||
for (int x=0 ;x<listP2.size();x++) { |
|||
for (Player PlayerX: team2.players) { |
|||
if(PlayerX.getnom().equals(listP2.get(x))) { |
|||
PlayerX.setInTrade(false); |
|||
} |
|||
} |
|||
} |
|||
|
|||
//-----------------------OTHER JSP PARAMS---------------------------
|
|||
request.setAttribute("statBase", TRADE_test.mainTRADE.get(0)); |
|||
request.setAttribute("nbTeam", CALL_Fantasy.l1.leagueTeams.size()); |
|||
request.setAttribute("nbStats", CALL_Fantasy.l1.loadStatBaseTeam.size()); |
|||
request.setAttribute("team1", team1); |
|||
request.setAttribute("team1projectedRK", f.format(team1.getProjRK())); |
|||
request.setAttribute("team1projTot", f.format(team1.getProjTot())); |
|||
request.setAttribute("team1Stats", team1.stats); |
|||
request.setAttribute("team2", team2); |
|||
request.setAttribute("team2projectedRK", f.format(team2.getProjRK())); |
|||
request.setAttribute("team2projTot", f.format(team2.getProjTot())); |
|||
request.setAttribute("team2Stats", team2.stats); |
|||
|
|||
ArrayList<String> otherTstats = new ArrayList<String>(); |
|||
for (Teams teamX : CALL_Fantasy.l1.leagueTeams) { |
|||
if(teamX.getName()!=team1.getName() && teamX.getName()!=team2.getName()) { |
|||
otherTstats.add(f.format(teamX.getProjTot())); |
|||
} |
|||
} |
|||
request.setAttribute("otherTeamStats", otherTstats); |
|||
|
|||
RequestDispatcher rd = getServletContext().getRequestDispatcher("/DIV_trade.jsp"); |
|||
rd.forward(request, response); |
|||
|
|||
} |
|||
|
|||
/** |
|||
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) |
|||
*/ |
|||
//appelé lors du clic test fa
|
|||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,145 @@ |
|||
package call_pages; |
|||
|
|||
import java.io.*; |
|||
import java.io.PrintWriter; |
|||
|
|||
import javax.servlet.RequestDispatcher; |
|||
import javax.servlet.ServletException; |
|||
import javax.servlet.annotation.WebServlet; |
|||
import javax.servlet.http.HttpServlet; |
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
import javax.servlet.http.HttpSession; |
|||
|
|||
import org.openqa.selenium.WebDriver; |
|||
import org.openqa.selenium.firefox.FirefoxDriver; |
|||
import org.openqa.selenium.firefox.FirefoxProfile; |
|||
import org.openqa.selenium.phantomjs.PhantomJSDriver; |
|||
import org.openqa.selenium.phantomjs.PhantomJSDriverService; |
|||
import org.openqa.selenium.remote.DesiredCapabilities; |
|||
import org.openqa.selenium.support.ui.WebDriverWait; |
|||
|
|||
import com.google.gson.Gson; |
|||
|
|||
import functions.GRAPH_init; |
|||
import functions.GRAPH_rebuild; |
|||
import functions.MySQLAccess; |
|||
import functions.PROJ_analysis; |
|||
import jsoupImport.ImportPlayers; |
|||
import jsoupImport.ImportTeams; |
|||
import jsoupImport.ImportVars; |
|||
import objects.League; |
|||
|
|||
import objects.Teams; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.Collections; |
|||
|
|||
import call_pages.CALL_Fantasy; |
|||
|
|||
/** |
|||
* Servlet implementation class stat |
|||
*/ |
|||
@WebServlet("/fantasyServlet") |
|||
public class CALL_Fantasy extends HttpServlet { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
public static ArrayList<Teams> leagueTeams; |
|||
public static League l1; |
|||
public static MySQLAccess dao = new MySQLAccess(); |
|||
public static WebDriver driver; |
|||
public static WebDriverWait wait; |
|||
|
|||
/** |
|||
* @see HttpServlet#HttpServlet() |
|||
*/ |
|||
public CALL_Fantasy() { |
|||
super(); |
|||
// TODO Auto-generated constructor stub
|
|||
} |
|||
/** |
|||
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) |
|||
*/ |
|||
//appelé depuis la page league jsp pour récup les infos du graph
|
|||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { |
|||
|
|||
} |
|||
/** |
|||
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) |
|||
*/ |
|||
//lancé sur clic btn choose league
|
|||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { |
|||
|
|||
HttpSession session = request.getSession(); |
|||
|
|||
String year = request.getParameter("year"); |
|||
String league = request.getParameter("league"); |
|||
|
|||
if(l1 == null) { |
|||
leagueTeams = new ArrayList<Teams>(); |
|||
l1 = new League("",league,year); // TODO: set year
|
|||
try { |
|||
|
|||
System.setProperty("webdriver.gecko.driver", "geckodriver.exe"); |
|||
|
|||
/*DesiredCapabilities DesireCaps = new DesiredCapabilities(); |
|||
DesireCaps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, "phantomjs.exe"); |
|||
WebDriver driver = new PhantomJSDriver(DesireCaps);*/ |
|||
FirefoxProfile fProfile = new FirefoxProfile(); |
|||
|
|||
fProfile.setPreference("permissions.default.image", 2 ); |
|||
|
|||
driver = new FirefoxDriver(fProfile); |
|||
|
|||
wait = new WebDriverWait(driver, 20); |
|||
|
|||
dao.testIfExist(); |
|||
|
|||
|
|||
new ImportTeams();// fait importlinup et graph rebuild
|
|||
|
|||
|
|||
//classe par rank relatif avant display et apres calculf fait dans graph rebuild pour le moment
|
|||
for (int z = 0; z < CALL_Fantasy.l1.nbTeams; z++) { |
|||
CALL_Fantasy.l1.leagueTeams.get(z).setValToRank((float)CALL_Fantasy.l1.leagueTeams.get(z).getTotalrotPtsRel()); |
|||
} |
|||
Collections.sort(CALL_Fantasy.l1.leagueTeams); |
|||
Collections.reverse(CALL_Fantasy.l1.leagueTeams); |
|||
|
|||
|
|||
//importe les joueurs des équipes pour projection
|
|||
new ImportPlayers(); |
|||
PROJ_analysis.calculate(); //need import players
|
|||
for(Teams teamX : CALL_Fantasy.l1.leagueTeams) { |
|||
teamX.setProjRKX(teamX.getProjRK()); |
|||
teamX.setProjTotX(teamX.getProjTot()); |
|||
} |
|||
|
|||
} catch (Exception e) { |
|||
// TODO Auto-generated catch block
|
|||
e.printStackTrace(); |
|||
|
|||
RequestDispatcher rd = getServletContext().getRequestDispatcher("/index.jsp"); |
|||
rd.forward(request, response); |
|||
} |
|||
} |
|||
|
|||
String statsJson = new Gson().toJson(CALL_Fantasy.l1.loadStatBaseTeam); |
|||
request.setAttribute("statsJson", statsJson); |
|||
request.setAttribute("statsBase", CALL_Fantasy.l1.loadStatBaseTeam); |
|||
|
|||
session.setAttribute("teamList", CALL_Fantasy.l1.leagueTeams); |
|||
request.setAttribute("leagueName", CALL_Fantasy.l1.getName()); |
|||
request.setAttribute("season", CALL_Fantasy.l1.getSeason()); |
|||
request.setAttribute("day", CALL_Fantasy.l1.nbDaysPlayed); |
|||
request.setAttribute("totDays", CALL_Fantasy.l1.getNbTotalDays()); |
|||
|
|||
RequestDispatcher rd = getServletContext().getRequestDispatcher("/PAGE_league.jsp"); |
|||
rd.forward(request, response); |
|||
|
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
@ -0,0 +1,185 @@ |
|||
package call_pages; |
|||
|
|||
import java.io.*; |
|||
import java.io.PrintWriter; |
|||
import java.text.DecimalFormat; |
|||
|
|||
import javax.servlet.RequestDispatcher; |
|||
import javax.servlet.ServletException; |
|||
import javax.servlet.annotation.WebServlet; |
|||
import javax.servlet.http.HttpServlet; |
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
|
|||
import com.google.gson.Gson; |
|||
|
|||
import call_pages.CALL_Fantasy; |
|||
import functions.FA_testPlayer; |
|||
import functions.PROJ_analysis; |
|||
import functions.RANKS_fill; |
|||
|
|||
import jsoupImport.ImportLineups; |
|||
import jsoupImport.ImportPlayerStats; |
|||
import jsoupImport.ImportPlayers; |
|||
import jsoupImport.ImportTeams; |
|||
import objects.League; |
|||
import objects.Player; |
|||
import objects.Stat; |
|||
import objects.Teams; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.Collections; |
|||
import java.util.Comparator; |
|||
|
|||
|
|||
/** |
|||
* Servlet implementation class stat |
|||
*/ |
|||
@WebServlet("/teamServlet") |
|||
public class CALL_Team extends HttpServlet { |
|||
|
|||
/** |
|||
* @see HttpServlet#HttpServlet() |
|||
*/ |
|||
public CALL_Team() { |
|||
super(); |
|||
// TODO Auto-generated constructor stub
|
|||
} |
|||
|
|||
/** |
|||
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) |
|||
*/ |
|||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { |
|||
|
|||
} |
|||
|
|||
|
|||
/** |
|||
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) |
|||
*/ |
|||
//appelé lors du choix d une équipe
|
|||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { |
|||
|
|||
|
|||
String team = request.getParameter("teamId"); |
|||
int chosenT = Integer.parseInt(team); |
|||
final DecimalFormat f = new DecimalFormat("0.#"); |
|||
final DecimalFormat in = new DecimalFormat("0.##"); |
|||
|
|||
Teams team1 = CALL_Fantasy.l1.leagueTeams.get(0);; |
|||
for (int x=0;x<CALL_Fantasy.l1.leagueTeams.size();x++) { |
|||
if(CALL_Fantasy.l1.leagueTeams.get(x).getID() == chosenT) { |
|||
team1 = CALL_Fantasy.l1.leagueTeams.get(x); |
|||
} |
|||
} |
|||
|
|||
String action = request.getParameter("action"); |
|||
String playerId = request.getParameter("playerId"); |
|||
Player bestPlayer = new Player("tmp"); |
|||
|
|||
//new ImportPlayers();// need to be called before trade
|
|||
//new ImportPlayerStats();//needed for test fa
|
|||
//PROJ_analysis.calculate(); //need import players
|
|||
//new ImportLineups();//--> PROJ_analysis : needed for fillPlayerRKinTeam
|
|||
ArrayList<Player> players = team1.players; |
|||
|
|||
if(action != null) { |
|||
bestPlayer = team1.players.get(Integer.parseInt(playerId)); |
|||
}else { |
|||
//-----------remove players if added in trade panel------------------------
|
|||
for (int x=0;x<players.size();x++) { |
|||
if(players.get(x).teamID != team1.getID()){ |
|||
players.remove(x); |
|||
x-=1; |
|||
} |
|||
} |
|||
//----------------calculate player rk in team for display----------------
|
|||
if(players.get(2).getInterVal() == 0.0) { |
|||
//fill rank of players in team
|
|||
RANKS_fill.fillPlayerRKinTeam(team1); |
|||
} |
|||
//----------------add teamId in free agents----------------------------
|
|||
for (final Player playerx : CALL_Fantasy.l1.leaguePlayers) { |
|||
if (playerx.isFA) { |
|||
playerx.teamID = team1.getID(); |
|||
} |
|||
} |
|||
|
|||
//----------------calculate potential max points for each player in team----------
|
|||
double maxPoint = 0; |
|||
for (final Player playerx : CALL_Fantasy.l1.leagueTeams.get(chosenT).players) { |
|||
if(playerx.faToCalculate){ |
|||
FA_testPlayer.testPlayer(CALL_Fantasy.l1.leagueTeams.get(chosenT),playerx); |
|||
} |
|||
if(playerx.getPotPoint() > maxPoint) { |
|||
bestPlayer = playerx; |
|||
maxPoint = playerx.getPotPoint(); |
|||
} |
|||
} |
|||
} |
|||
|
|||
FA_testPlayer.mainFA.clear(); |
|||
|
|||
FA_testPlayer.testPlayer(CALL_Fantasy.l1.leagueTeams.get(chosenT),bestPlayer); |
|||
//-----------calcule la nouvelle projection
|
|||
PROJ_analysis.calculate(); |
|||
|
|||
Collections.sort(FA_testPlayer.mainFA, new ListOfStatComparator()); |
|||
Collections.reverse(FA_testPlayer.mainFA); |
|||
|
|||
request.setAttribute("team1", team1); |
|||
request.setAttribute("team1Stats", team1.stats); |
|||
request.setAttribute("nbTeam", CALL_Fantasy.l1.leagueTeams.size()); |
|||
request.setAttribute("mainFA", FA_testPlayer.mainFA); |
|||
request.setAttribute("statBase", FA_testPlayer.mainFA.get(0)); |
|||
|
|||
request.setAttribute("team1projectedRK", f.format(team1.getProjRK())); |
|||
request.setAttribute("team1projTot", f.format(team1.getProjTot())); |
|||
ArrayList<String> otherTstats = new ArrayList<String>(); |
|||
for (Teams teamX : CALL_Fantasy.l1.leagueTeams) { |
|||
if(teamX.getName()!=team1.getName()) { |
|||
otherTstats.add(f.format(teamX.getProjTot())); |
|||
} |
|||
} |
|||
request.setAttribute("otherTeamStats", otherTstats); |
|||
|
|||
ArrayList<String> potPts = new ArrayList<String>(); |
|||
ArrayList<String> potRK = new ArrayList<String>(); |
|||
for (Player player : players) { |
|||
potPts.add(String.valueOf(player.getPotPoint())); |
|||
potRK.add(String.valueOf(player.getPotRK())); |
|||
player.setValToRank((float)player.getPotPoint()); |
|||
} |
|||
Collections.sort(players); |
|||
Collections.reverse(players); |
|||
|
|||
|
|||
String potPtsJson = new Gson().toJson(potPts); |
|||
String potRKJson = new Gson().toJson(potRK); |
|||
request.setAttribute("potPtsJson", potPtsJson); |
|||
request.setAttribute("potRKJson", potRKJson); |
|||
|
|||
request.setAttribute("playerList", players); |
|||
request.setAttribute("teamID", chosenT); |
|||
request.setAttribute("player", bestPlayer); |
|||
|
|||
if(action != null) { |
|||
RequestDispatcher rd = getServletContext().getRequestDispatcher("/DIV_FA.jsp"); |
|||
rd.forward(request, response); |
|||
}else { |
|||
RequestDispatcher rd = getServletContext().getRequestDispatcher("/PAGE_team.jsp"); |
|||
rd.forward(request, response); |
|||
} |
|||
|
|||
|
|||
} |
|||
static final class ListOfStatComparator implements Comparator < ArrayList < Stat >> { |
|||
|
|||
@Override |
|||
public int compare(ArrayList < Stat > o1, ArrayList < Stat > o2) { |
|||
// do other error checks here as well... such as null. outofbounds, etc
|
|||
return o1.get(0).compareTo(o2.get(0)); |
|||
} |
|||
|
|||
} |
|||
} |
|||
@ -0,0 +1,53 @@ |
|||
package call_pages; |
|||
|
|||
import java.io.*; |
|||
|
|||
import javax.servlet.RequestDispatcher; |
|||
import javax.servlet.ServletException; |
|||
import javax.servlet.annotation.WebServlet; |
|||
import javax.servlet.http.HttpServlet; |
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
|
|||
import call_pages.CALL_Fantasy; |
|||
|
|||
|
|||
|
|||
/** |
|||
* Servlet implementation class stat |
|||
*/ |
|||
@WebServlet("/tradeServlet") |
|||
public class CALL_Trade extends HttpServlet { |
|||
|
|||
/** |
|||
* @see HttpServlet#HttpServlet() |
|||
*/ |
|||
public CALL_Trade() { |
|||
super(); |
|||
// TODO Auto-generated constructor stub
|
|||
} |
|||
|
|||
/** |
|||
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) |
|||
*/ |
|||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { |
|||
|
|||
|
|||
} |
|||
|
|||
/** |
|||
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) |
|||
*/ |
|||
//appelé lors clic btn trade
|
|||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { |
|||
|
|||
response.setContentType("text/html"); |
|||
|
|||
request.setAttribute("teamList", CALL_Fantasy.l1.leagueTeams); |
|||
|
|||
RequestDispatcher rd = getServletContext().getRequestDispatcher("/PAGE_trade.jsp"); |
|||
rd.forward(request, response); |
|||
|
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,5 @@ |
|||
package call_pages; |
|||
|
|||
public class TESTcss { |
|||
|
|||
} |
|||
@ -0,0 +1,24 @@ |
|||
/*package functions; |
|||
|
|||
//-----------------RETURN THE DAY FOR A SPECIFIED RECORD NUMBER----------------------(TEAM)
|
|||
public Date getDate(int jour) { |
|||
Date d = new Date() ; |
|||
SQLiteDatabase db = this.getWritableDatabase(); |
|||
String selectQuery = "SELECT " + KEY_DAY + " FROM " + TABLE_RECORDS + " WHERE " + KEY_RECORDCOUNT + " = '" + jour +"'" ; |
|||
Cursor cursor = db.rawQuery(selectQuery, null); |
|||
if(cursor.moveToFirst()) |
|||
{ |
|||
try{ |
|||
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); // here set the pattern as you date in string was containing like date/month/year
|
|||
d = sdf.parse(cursor.getString(0)); |
|||
}catch(ParseException ex){ |
|||
// handle parsing exception if date string was different from the pattern applying into the SimpleDateFormat contructor
|
|||
} |
|||
} |
|||
cursor.close(); |
|||
return d; |
|||
} |
|||
|
|||
} |
|||
|
|||
*/ |
|||
@ -0,0 +1,143 @@ |
|||
package functions; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.Collection; |
|||
import java.util.Collections; |
|||
import java.util.Comparator; |
|||
|
|||
import call_pages.CALL_Fantasy; |
|||
import objects.League; |
|||
import objects.Player; |
|||
import objects.Stat; |
|||
import objects.Teams; |
|||
|
|||
/** |
|||
* Created by LeJay on 22.02.2017. |
|||
*/ |
|||
|
|||
public class FA_testPlayer extends CALL_Fantasy { |
|||
|
|||
/** |
|||
* |
|||
*/ |
|||
private static final long serialVersionUID = 1L; |
|||
public static ArrayList<ArrayList<Stat>> mainFA = new ArrayList<>(); |
|||
public static Player[] players = new Player[400]; |
|||
public static double maxPts = 0.0; |
|||
public static double maxRK = 1000.0; |
|||
int nbPlay = 0; |
|||
public static int sortKey; |
|||
|
|||
public static void testPlayer(Teams teams, Player playerX){ |
|||
|
|||
maxPts = 0.0; |
|||
maxRK = 1000.0; |
|||
|
|||
int Pcode = 0; |
|||
for(Player players : teams.players){ |
|||
if(players.getnom().equals(playerX.getnom())){ |
|||
break; |
|||
} |
|||
Pcode++; |
|||
} |
|||
|
|||
teams.setInTrade(true); |
|||
//met en mémoire le joueur remplacé
|
|||
Player rePutPlayer = playerX; |
|||
|
|||
//----------------------------loop all league players
|
|||
for (Player playerFA : l1.leaguePlayers) { |
|||
if (playerFA.isFA) { |
|||
int nbStat = 0; |
|||
|
|||
ArrayList<Stat> subFA = new ArrayList<Stat>(1 + l1.nbStatsTeam + l1.nbTeams * 2); |
|||
|
|||
//echange un player contre un freeAgent
|
|||
teams.players.set(Pcode,playerFA); |
|||
playerX = teams.players.get(Pcode); |
|||
|
|||
//-----------calcule la nouvelle projection
|
|||
PROJ_analysis.calculate(); |
|||
|
|||
// RK-P
|
|||
//enregistre l'impact sur chaque stats (ranking et valeur) + classement
|
|||
Stat valGeneral = new Stat("RK-P"); |
|||
valGeneral.setPlayer(playerX.getnom()); |
|||
//nom joueur droppé in team name of stat
|
|||
valGeneral.setTeam(rePutPlayer.getnom()); |
|||
valGeneral.setProjectedRK(teams.getProjRK()); |
|||
valGeneral.setValProjection(Double.toString(teams.getProjTot())); |
|||
valGeneral.setValToRank(Float.parseFloat(valGeneral.getValProjection())); |
|||
subFA.add(valGeneral); |
|||
nbStat++; |
|||
|
|||
if (teams.getProjTot() > maxPts) { |
|||
maxPts = teams.getProjTot(); |
|||
} |
|||
if (teams.getProjRK() < maxRK) { |
|||
maxRK = teams.getProjRK(); |
|||
} |
|||
|
|||
//----------------------------loop all stats
|
|||
//add projection results for each stat category
|
|||
for (int j = 0; j <= l1.loopStatsTeam; j++) { |
|||
Stat valStats = new Stat(l1.loadStatBaseTeam.get(j).getName()); |
|||
valStats.setPlayer(playerX.getnom()); |
|||
valStats.setTeam(teams.getName()); |
|||
valStats.setProjectedRK(teams.stats.get(j).getProjectedRK()); |
|||
valStats.setValProjection(teams.stats.get(j).getValProjection()); |
|||
subFA.add(valStats); |
|||
nbStat++; |
|||
} |
|||
//----------------------------loop all other teams
|
|||
//add impact on other players ranking
|
|||
for (Teams teamX : l1.leagueTeams) { |
|||
if (!teamX.getName().equals(teams.getName())) { |
|||
Stat impacts = new Stat(teamX.getName()); |
|||
impacts.setPlayer(playerX.getnom()); |
|||
impacts.setTeam(teams.getName()); |
|||
impacts.setProjectedRK(teamX.getProjRK()); |
|||
impacts.setValProjection(Double.toString(teamX.getProjTot())); |
|||
subFA.add(impacts); |
|||
nbStat++; |
|||
} |
|||
} |
|||
|
|||
if((teams.getProjTot() > teams.getProjTotX()-1)) { |
|||
mainFA.add(subFA); |
|||
} |
|||
|
|||
} |
|||
|
|||
} |
|||
|
|||
sortKey=0; |
|||
Collections.sort(mainFA, new ListOfStatComparator()); |
|||
sortKey=1; |
|||
Collections.sort(mainFA, new ListOfStatComparator()); |
|||
Collections.reverse(mainFA); |
|||
|
|||
//replace le bon joueur dans d'équipe
|
|||
teams.players.set(Pcode,rePutPlayer); |
|||
teams.players.get(Pcode).setInTrade(false); |
|||
teams.players.get(Pcode).setPotPoint(maxPts); |
|||
teams.players.get(Pcode).setPotRK(maxRK); |
|||
teams.players.get(Pcode).faToCalculate = false; |
|||
|
|||
teams.setInTrade(false); |
|||
} |
|||
|
|||
static final class ListOfStatComparator implements Comparator < ArrayList < Stat >> { |
|||
|
|||
@Override |
|||
public int compare(ArrayList < Stat > o1, ArrayList < Stat > o2) { |
|||
// do other error checks here as well... such as null. outofbounds, etc
|
|||
if(sortKey==0) { |
|||
return new Float(o1.get(0).getProjectedRK()).compareTo(new Float(o2.get(0).getProjectedRK())); |
|||
}else { |
|||
return new Float(o1.get(0).getValProjection()).compareTo(new Float(o2.get(0).getValProjection())); |
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,121 @@ |
|||
package functions; |
|||
|
|||
import java.util.ArrayList; |
|||
import java.util.Collections; |
|||
import java.util.Comparator; |
|||
import java.util.List; |
|||
|
|||
import com.google.visualization.datasource.base.TypeMismatchException; |
|||
import com.google.visualization.datasource.datatable.ColumnDescription; |
|||
import com.google.visualization.datasource.datatable.DataTable; |
|||
import com.google.visualization.datasource.datatable.value.ValueType; |
|||
|
|||
import call_content.GRAPH_CALL; |
|||
import call_pages.CALL_Fantasy; |
|||
import objects.Stat; |
|||
|
|||
|
|||
public class GRAPH_init { // called from importTeams
|
|||
|
|||
public DataTable data(String type){ |
|||
|
|||
|
|||
GRAPH_CALL.maxVal=0; |
|||
GRAPH_CALL.lowVal=100; |
|||
|
|||
int nbDay = 0; |
|||
float test =0; |
|||
|
|||
try { |
|||
nbDay = CALL_Fantasy.dao.nbDay(); |
|||
} catch (Exception e1) { |
|||
// TODO Auto-generated catch block
|
|||
e1.printStackTrace(); |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
DataTable data = new DataTable(); |
|||
ArrayList<ColumnDescription> cols = new ArrayList<ColumnDescription>(); |
|||
|
|||
//cree les colonnes pour les données du graphique
|
|||
cols.add(new ColumnDescription("id", ValueType.NUMBER, "Day")); |
|||
for(int i = 0; i< CALL_Fantasy.l1.nbTeams;i++) { |
|||
cols.add(new ColumnDescription(CALL_Fantasy.l1.leagueTeams.get(i).getName(), ValueType.NUMBER, CALL_Fantasy.l1.leagueTeams.get(i).getName())); |
|||
} |
|||
data.addColumns(cols); |
|||
|
|||
try { |
|||
//parcours les jours
|
|||
for(int i = 0; i< CALL_Fantasy.l1.nbDaysPlayed;i++) { //
|
|||
|
|||
List<Float> valuesPoint = new ArrayList<Float>(CALL_Fantasy.l1.nbTeams+1); |
|||
List<Float> valuesStat = new ArrayList<Float>(CALL_Fantasy.l1.nbTeams+1); //CALL_Fantasy.l1.nbTeams+1
|
|||
|
|||
|
|||
if(type.equals("mainGraph")) { |
|||
valuesPoint.add((float) i); |
|||
}else { |
|||
valuesStat.add((float) i); |
|||
} |
|||
|
|||
|
|||
|
|||
// parcours les équipes
|
|||
for(int j = 0; j< CALL_Fantasy.l1.nbTeams;j++) { |
|||
//recupere les données de la DB --- need ImportLineups
|
|||
try { |
|||
if(type.equals("mainGraph")) { |
|||
test = CALL_Fantasy.dao.stat(CALL_Fantasy.l1.leagueTeams.get(j).getID(),i); |
|||
valuesPoint.add(test); |
|||
}else { |
|||
test = CALL_Fantasy.dao.statVal(CALL_Fantasy.l1.leagueTeams.get(j).getID(),i,type); |
|||
System.out.println(test); |
|||
valuesStat.add(test); |
|||
} |
|||
|
|||
} catch (Exception e) { |
|||
// TODO Auto-generated catch block
|
|||
e.printStackTrace(); |
|||
} |
|||
|
|||
|
|||
if(i==nbDay-1){ |
|||
if(GRAPH_CALL.maxVal<test)GRAPH_CALL.maxVal=test; |
|||
if(GRAPH_CALL.lowVal>test && test !=0)GRAPH_CALL.lowVal=test; |
|||
} |
|||
|
|||
} |
|||
|
|||
if(type.equals("mainGraph")) { |
|||
data.addRowFromValues(valuesPoint.toArray()); |
|||
}else { |
|||
data.addRowFromValues(valuesStat.toArray()); |
|||
} |
|||
|
|||
} |
|||
|
|||
if(type.contains("%")) { |
|||
GRAPH_CALL.maxVal = (float) (GRAPH_CALL.maxVal * 1.01); |
|||
GRAPH_CALL.lowVal = (float) (GRAPH_CALL.lowVal *0.99); |
|||
}else { |
|||
GRAPH_CALL.maxVal = (float) (GRAPH_CALL.maxVal * 1.03); |
|||
GRAPH_CALL.lowVal = (float) (GRAPH_CALL.lowVal *0.97); |
|||
} |
|||
|
|||
if(GRAPH_CALL.maxVal<test) {GRAPH_CALL.maxVal=test;} |
|||
if(GRAPH_CALL.lowVal>test) {GRAPH_CALL.lowVal=test;} |
|||
|
|||
} catch (TypeMismatchException e) { |
|||
System.out.println("Invalid type!"); |
|||
} |
|||
|
|||
return data; |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,141 @@ |
|||
package functions; |
|||
|
|||
import call_pages.CALL_Fantasy; |
|||
import jsoupImport.ImportLineups; |
|||
import objects.Teams; |
|||
|
|||
public class GRAPH_rebuild { |
|||
|
|||
|
|||
public GRAPH_rebuild() throws Exception { |
|||
|
|||
String title; |
|||
//erase table
|
|||
CALL_Fantasy.dao.delRecord(""); // can be removed in some case
|
|||
|
|||
//--------Reset leagueTeams Season Stats----------------
|
|||
for (int i = 0; i < CALL_Fantasy.l1.leagueTeams.size(); i++) { |
|||
CALL_Fantasy.l1.leagueTeams.get(i).setGamesPlayed(0); |
|||
for (int b = 0; b <= CALL_Fantasy.l1.loopStatsTeam; b++) |
|||
if (CALL_Fantasy.l1.leagueTeams.get(i).stats.get(b).getName().contains("/")) |
|||
CALL_Fantasy.l1.leagueTeams.get(i).stats.get(b).setValSeason(0 + "/" + 0); |
|||
else |
|||
CALL_Fantasy.l1.leagueTeams.get(i).stats.get(b).setValSeason("" + 0); |
|||
} |
|||
|
|||
//loop through all period--------------------------------------------PERIOD
|
|||
for (int periode = 0; periode < CALL_Fantasy.l1.getNbDaysPlayed(); periode++) { |
|||
|
|||
//test if record exist for that period
|
|||
if (CALL_Fantasy.dao.periodExist(periode) == 0){ |
|||
|
|||
//-----------------go through teams to set ranks at period---------TEAM
|
|||
for (int i = 0; i < CALL_Fantasy.l1.nbTeams; i++) { //first row is the col names so skip it.
|
|||
//reset nbgames for the new team
|
|||
int nbGames = 0; |
|||
int newNBgames =0; |
|||
//go through all stats to increment for each period-----------------STATS
|
|||
for (int b = 0; b <= CALL_Fantasy.l1.loopStatsTeam; b++) { |
|||
//skip team stat decomposed -- not in ranking but used to calculate %
|
|||
if (!CALL_Fantasy.l1.loadStatBaseTeam.get(b).getName().contains("/")) { |
|||
//reset totals for the new stat
|
|||
int totStat = 0; |
|||
int totStat1 = 0; |
|||
int totStat2 = 0; |
|||
//go through all slots of that period to gather all stats----------------------SLOTS
|
|||
for (int k = 0; k < CALL_Fantasy.l1.leagueTeams.get(i).slots.length; k++) { |
|||
if (CALL_Fantasy.l1.leagueTeams.get(i).slots[k] != null) { |
|||
if (CALL_Fantasy.l1.leagueTeams.get(i).slots[k].players[periode] != null) { |
|||
//don't count players aligned on bench slot
|
|||
if (!CALL_Fantasy.l1.leagueTeams.get(i).slots[k].getNomPos().equals("Bench") && !CALL_Fantasy.l1.leagueTeams.get(i).slots[k].getNomPos().equals("IR")) { |
|||
if(b==0)nbGames++; |
|||
if (!CALL_Fantasy.l1.leagueTeams.get(i).slots[k].players[periode].stats.get(b).getName().contains("/")) { |
|||
totStat += Integer.parseInt(CALL_Fantasy.l1.leagueTeams.get(i).slots[k].players[periode].stats.get(b).getStatVal()); |
|||
} else { |
|||
String[] decomp = CALL_Fantasy.l1.leagueTeams.get(i).slots[k].players[periode].stats.get(b).getStatVal().split("/"); |
|||
totStat1 += Integer.parseInt(decomp[0]); |
|||
totStat2 += Integer.parseInt(decomp[1]); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
if(b==0) { |
|||
newNBgames = CALL_Fantasy.l1.leagueTeams.get(i).getGamesPlayed() + nbGames; |
|||
CALL_Fantasy.l1.leagueTeams.get(i).setGamesPlayed(newNBgames); |
|||
} |
|||
if (!CALL_Fantasy.l1.leagueTeams.get(i).stats.get(b).getName().contains("%")) { |
|||
//calculate and set new total for further use
|
|||
|
|||
//System.out.println(Fantasy.l1.leagueTeams.get(i).getName());
|
|||
//System.out.println(Fantasy.l1.leagueTeams.get(i).stats.get(b).getName());
|
|||
//System.out.println(Fantasy.l1.leagueTeams.get(i).stats.get(b).getValSeason());
|
|||
|
|||
int newTotal = Integer.parseInt(CALL_Fantasy.l1.leagueTeams.get(i).stats.get(b).getValSeason())+totStat; |
|||
CALL_Fantasy.l1.leagueTeams.get(i).stats.get(b).setValSeason(""+newTotal); |
|||
//calculate and set new relative for actual use
|
|||
float newRalative=0; |
|||
if(newNBgames!=0){ |
|||
newRalative =(float) newTotal/newNBgames; |
|||
} |
|||
CALL_Fantasy.l1.leagueTeams.get(i).stats.get(b).setValRelative(newRalative); |
|||
} else { |
|||
//b+1 because inverted stats bwtween player and team
|
|||
String[] decomp = CALL_Fantasy.l1.leagueTeams.get(i).stats.get(b+1).getValSeason().split("/"); |
|||
//calculate and set new total for further use
|
|||
int newTotal1 = Integer.parseInt(decomp[0].replace(".0",""))+totStat1; |
|||
int newTotal2 = Integer.parseInt(decomp[1].replace(".0",""))+totStat2; |
|||
CALL_Fantasy.l1.leagueTeams.get(i).stats.get(b+1).setValSeason(newTotal1+"/"+newTotal2); |
|||
|
|||
float totStatPourcent; |
|||
if (newTotal2!=0){ |
|||
totStatPourcent = (float)newTotal1 / newTotal2 * 100; |
|||
}else{ |
|||
totStatPourcent = 100 ; |
|||
} |
|||
CALL_Fantasy.l1.leagueTeams.get(i).stats.get(b).setValRelative(totStatPourcent); |
|||
} |
|||
} |
|||
}//end loop stats
|
|||
|
|||
}//end loop team
|
|||
|
|||
//----------------------fill stat ranks
|
|||
RANKS_fill.fillStatRank(); |
|||
//float[] arrVal = RANKS_fill.fillStatRankTEST();
|
|||
//-------------fill team ranks---------------
|
|||
RANKS_fill.fillTeamRank(); |
|||
//float[] arrVal2 = RANKS_fill.fillTeamRankTEST();
|
|||
|
|||
System.out.println("period -- "+periode); |
|||
|
|||
//enregistre le ranking relatif
|
|||
int nbRec = CALL_Fantasy.dao.nbDay() + 1; |
|||
for (int i = 0; i < Teams.getNumOfInstances(); i++) { |
|||
for (int j = 0; j <= CALL_Fantasy.l1.loopStatsTeam; j++) { |
|||
if(!CALL_Fantasy.l1.loadStatBaseTeam.get(j).getName().contains("/")){ |
|||
System.out.println(CALL_Fantasy.l1.leagueTeams.get(i).getName() + "/" + CALL_Fantasy.l1.leagueTeams.get(i).stats.get(j).getRank()); |
|||
CALL_Fantasy.dao.addRecord(CALL_Fantasy.l1.leagueTeams.get(i).stats.get(j), CALL_Fantasy.l1.leagueTeams.get(i), nbRec,periode); |
|||
} |
|||
} |
|||
} |
|||
|
|||
}//if period exist
|
|||
|
|||
}//end loop period
|
|||
|
|||
} |
|||
|
|||
boolean isDouble(String str) { |
|||
try { |
|||
Double.parseDouble(str); |
|||
return true; |
|||
} catch (NumberFormatException e) { |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
@ -0,0 +1,12 @@ |
|||
package functions; |
|||
|
|||
|
|||
public class Main { |
|||
|
|||
public static void main(String[] args) throws Exception { |
|||
MySQLAccess dao = new MySQLAccess(); |
|||
dao.readTeam(); |
|||
} |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,660 @@ |
|||
package functions; |
|||
|
|||
import java.sql.Connection; |
|||
import java.sql.DriverManager; |
|||
import java.sql.PreparedStatement; |
|||
import java.sql.ResultSet; |
|||
import java.sql.SQLException; |
|||
import java.sql.Statement; |
|||
import java.util.ArrayList; |
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
import com.ibm.icu.text.SimpleDateFormat; |
|||
import com.ibm.icu.util.Calendar; |
|||
|
|||
import call_pages.CALL_Fantasy; |
|||
import objects.Player; |
|||
import objects.Stat; |
|||
import objects.Teams; |
|||
|
|||
public class MySQLAccess { |
|||
|
|||
// Database Name
|
|||
private static final String DATABASE_NAME = "test30"; |
|||
|
|||
private static final String DATABASE_DRIVER = "com.mysql.jdbc.Driver"; |
|||
private static final String DATABASE_URL = "jdbc:mysql://localhost:3306/" + DATABASE_NAME ; |
|||
private static final String USERNAME = "root"; |
|||
private static final String PASSWORD = "1800vevey"; |
|||
private static final String MAX_POOL = "30000"; |
|||
|
|||
// Contacts table name
|
|||
private static final String TABLE_TEAMS = "teams"; |
|||
private static final String TABLE_RECORDS = "records"; |
|||
private static final String TABLE_STATS = "stats"; |
|||
|
|||
// Contacts Table Columns names
|
|||
private static final String KEY_ID = "id"; |
|||
|
|||
private static final String KEY_TEAM = "team"; |
|||
|
|||
private static final String KEY_TOTREL = "totalRelatif"; |
|||
|
|||
private static final String KEY_DAY = "Day"; |
|||
private static final String KEY_TEAMID = "teamid"; |
|||
|
|||
private static final String KEY_STATID = "statid"; |
|||
private static final String KEY_STATNAME = "statname"; |
|||
|
|||
private static final String KEY_PLAYER = "player"; |
|||
private static final String KEY_SLOT = "position"; |
|||
private static final String KEY_SLOTID = "slotID"; |
|||
|
|||
private static final String KEY_PERIOD = "period"; |
|||
|
|||
private static final String KEY_VALSTAT = "valstat"; |
|||
private static final String KEY_RKSTAT = "rkstat"; |
|||
private static final String KEY_RECORDCOUNT = "recordCount"; |
|||
|
|||
private static Connection connect = null; |
|||
private static Statement statement = null; |
|||
private static PreparedStatement preparedStatement = null; |
|||
private static ResultSet resultSet = null; |
|||
|
|||
public static void main(String[] args) throws Exception { |
|||
MySQLAccess dao = new MySQLAccess(); |
|||
dao.createDataBase(); |
|||
dao.createTable(); |
|||
|
|||
//dao.addTeam();
|
|||
//dao.readTeam();
|
|||
//dao.addStat();
|
|||
dao.readStats(); |
|||
|
|||
} |
|||
|
|||
public void testIfExist() throws Exception { |
|||
try { |
|||
boolean exist = false; |
|||
|
|||
Class.forName(DATABASE_DRIVER).newInstance(); |
|||
String url = "jdbc:mysql://localhost:3306"; |
|||
connect = DriverManager.getConnection(url, USERNAME, PASSWORD); |
|||
|
|||
ResultSet resultSet = connect.getMetaData().getCatalogs(); |
|||
|
|||
while (resultSet.next()) { |
|||
|
|||
String databaseName = resultSet.getString(1); |
|||
if(databaseName.equals(DATABASE_NAME)){ |
|||
exist = true; |
|||
} |
|||
} |
|||
resultSet.close(); |
|||
|
|||
if(exist == false) { |
|||
CALL_Fantasy.dao.createDataBase(); |
|||
CALL_Fantasy.dao.createTable(); |
|||
} |
|||
|
|||
|
|||
} catch (Exception e) {throw e;} finally {close();} |
|||
} |
|||
|
|||
public void createDataBase() throws Exception { |
|||
try { |
|||
// This will load the MySQL driver, each DB has its own driver
|
|||
Class.forName(DATABASE_DRIVER).newInstance(); |
|||
String url = "jdbc:mysql://localhost:3306"; |
|||
connect = DriverManager.getConnection(url, USERNAME, PASSWORD); |
|||
statement = connect.createStatement(); |
|||
|
|||
String hrappSQL = "CREATE DATABASE "+ DATABASE_NAME; |
|||
statement.executeUpdate(hrappSQL); |
|||
|
|||
} catch (Exception e) {throw e;} finally {close();} |
|||
} |
|||
|
|||
public void createTable() throws Exception { |
|||
try { |
|||
// This will load the MySQL driver, each DB has its own driver
|
|||
Class.forName(DATABASE_DRIVER).newInstance(); |
|||
String url = "jdbc:mysql://localhost:3306/"+ DATABASE_NAME; |
|||
connect = DriverManager.getConnection(url, USERNAME, PASSWORD); |
|||
statement = connect.createStatement(); |
|||
|
|||
/* String CREATE_TEAMS_TABLE = "CREATE TABLE " + TABLE_TEAMS + "(" |
|||
+ KEY_ID + " INTEGER PRIMARY KEY," + KEY_TEAM + " TEXT" +")"; |
|||
statement.executeUpdate(CREATE_TEAMS_TABLE);*/ |
|||
|
|||
String CREATE_RECORDS_TABLE = "CREATE TABLE " + TABLE_RECORDS + "(" |
|||
+ KEY_ID + " INTEGER PRIMARY KEY NOT NULL AUTO_INCREMENT," + KEY_DAY + " TEXT," + KEY_TEAMID + " TEXT," + KEY_PERIOD + " INTEGER," |
|||
+ KEY_STATNAME + " TEXT," + KEY_VALSTAT + " TEXT," + KEY_RKSTAT + " TEXT," + KEY_RECORDCOUNT + " TEXT" +")"; |
|||
statement.executeUpdate(CREATE_RECORDS_TABLE); |
|||
|
|||
String CREATE_STATS_TABLE = "CREATE TABLE " + TABLE_STATS + "(" |
|||
+ KEY_ID + " INTEGER PRIMARY KEY NOT NULL AUTO_INCREMENT," + KEY_STATNAME + " TEXT," + KEY_VALSTAT + " TEXT," + KEY_PLAYER + " TEXT," |
|||
+ KEY_SLOT + " TEXT," + KEY_SLOTID + " INTEGER," + KEY_TEAMID + " INTEGER," + KEY_PERIOD + " INTEGER" + ")"; |
|||
statement.executeUpdate(CREATE_STATS_TABLE); |
|||
|
|||
} catch (Exception e) {throw e;} finally {close();} |
|||
} |
|||
|
|||
|
|||
//---------------ADD PLAYER STAT RECORD TO THE DATABASE ------------
|
|||
public void addStat(Stat stat, Player player, int teamID) throws Exception { |
|||
try { |
|||
// This will load the MySQL driver, each DB has its own driver
|
|||
Class.forName(DATABASE_DRIVER).newInstance(); |
|||
String url = "jdbc:mysql://localhost:3306/"+ DATABASE_NAME; |
|||
connect = DriverManager.getConnection(url, USERNAME, PASSWORD); |
|||
statement = connect.createStatement(); |
|||
|
|||
// PreparedStatements can use variables and are more efficient
|
|||
preparedStatement = connect |
|||
.prepareStatement("insert into " + TABLE_STATS + " ("+KEY_STATNAME+", "+KEY_PLAYER+","+KEY_TEAMID+","+KEY_VALSTAT+","+KEY_SLOTID+","+KEY_SLOT+","+KEY_PERIOD+") values (?, ?, ?, ?, ?, ?, ?)"); |
|||
|
|||
// Parameters start with 1
|
|||
preparedStatement.setString(1, stat.getName()); |
|||
preparedStatement.setString(2, player.getnom()); |
|||
preparedStatement.setInt(3, teamID); |
|||
preparedStatement.setString(4, stat.getStatVal()); |
|||
preparedStatement.setInt(5, stat.getSlotID()); |
|||
preparedStatement.setString(6, stat.getSlot()); |
|||
preparedStatement.setInt(7, stat.getPeriod()); |
|||
|
|||
preparedStatement.executeUpdate(); |
|||
|
|||
} catch (Exception e) {throw e;} finally { |
|||
if (preparedStatement != null) { |
|||
try { |
|||
preparedStatement.close(); |
|||
} catch (SQLException e) { /*ignored*/ } |
|||
} |
|||
if (statement != null) { |
|||
try { |
|||
statement.close(); |
|||
} catch (SQLException e) { /*ignored*/ } |
|||
} |
|||
if (connect != null) { |
|||
try { |
|||
connect.close(); |
|||
} catch (SQLException e) { /*ignored*/ } |
|||
} |
|||
|
|||
} |
|||
} |
|||
|
|||
//---------------ADD TEAM RELATIVE STAT RECORD TO THE DATABASE ------------
|
|||
public void addRecord(Stat stat, Teams teams, float rec, int period) throws Exception { |
|||
try { |
|||
// This will load the MySQL driver, each DB has its own driver
|
|||
Class.forName(DATABASE_DRIVER).newInstance(); |
|||
String url = "jdbc:mysql://localhost:3306/"+ DATABASE_NAME; |
|||
connect = DriverManager.getConnection(url, USERNAME, PASSWORD); |
|||
|
|||
|
|||
statement = connect.createStatement(); |
|||
|
|||
// PreparedStatements can use variables and are more efficient
|
|||
preparedStatement = connect |
|||
.prepareStatement("insert into " + TABLE_RECORDS + " ("+KEY_DAY+", "+KEY_TEAMID+","+KEY_STATNAME+","+KEY_VALSTAT+","+KEY_RKSTAT+","+KEY_RECORDCOUNT+","+KEY_PERIOD+") values (?, ?, ?, ?, ?, ?, ?)"); |
|||
|
|||
Date d1 = new Date(); |
|||
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); |
|||
String dayOf = sdf.format(d1); |
|||
|
|||
// Parameters start with 1
|
|||
preparedStatement.setString(1, dayOf); |
|||
preparedStatement.setInt(2, teams.getID()); |
|||
preparedStatement.setString(3, stat.getName()); |
|||
preparedStatement.setDouble(4, stat.getValRelative()); |
|||
preparedStatement.setDouble(5, stat.getRank()); |
|||
preparedStatement.setFloat(6, rec); |
|||
preparedStatement.setInt(7, period); |
|||
|
|||
//System.out.println("Ranking Record for team : " + teams.getName() + "("+teams.getID()+") / " + stat.getName() + " / " + stat.getRank() + " / " + period);
|
|||
|
|||
preparedStatement.executeUpdate(); |
|||
|
|||
} catch (Exception e) {throw e;} finally { |
|||
|
|||
if (preparedStatement != null) { |
|||
try { |
|||
preparedStatement.close(); |
|||
} catch (SQLException e) { /*ignored*/ } |
|||
} |
|||
if (statement != null) { |
|||
try { |
|||
statement.close(); |
|||
} catch (SQLException e) { /*ignored*/ } |
|||
} |
|||
if (connect != null) { |
|||
try { |
|||
connect.close(); |
|||
} catch (SQLException e) { /*ignored*/ } |
|||
} |
|||
} |
|||
} |
|||
|
|||
public List<Stat> getStatList(Teams teams,int period) throws Exception { |
|||
try { |
|||
// This will load the MySQL driver, each DB has its own driver
|
|||
Class.forName(DATABASE_DRIVER).newInstance(); |
|||
String url = "jdbc:mysql://localhost:3306/"+ DATABASE_NAME; |
|||
connect = DriverManager.getConnection(url, USERNAME, PASSWORD); |
|||
statement = connect.createStatement(); |
|||
|
|||
List<Stat> records = new ArrayList<Stat>(); |
|||
|
|||
resultSet = statement |
|||
.executeQuery("SELECT * FROM " + TABLE_STATS + " WHERE " + KEY_TEAMID + " = " + teams.getID() + " AND " + KEY_PERIOD + " = " + period); |
|||
|
|||
while (resultSet.next()) { |
|||
|
|||
Stat stat = new Stat(resultSet.getString(KEY_STATNAME)); |
|||
stat.setPeriod(resultSet.getInt(KEY_PERIOD)); |
|||
stat.setSlot(resultSet.getString(KEY_SLOT)); |
|||
stat.setSlotID(resultSet.getInt(KEY_SLOTID)); |
|||
stat.setPlayer(resultSet.getString(KEY_PLAYER));//4
|
|||
stat.setStatVal(resultSet.getString(KEY_VALSTAT)); |
|||
|
|||
records.add(stat); |
|||
} |
|||
|
|||
return records; |
|||
|
|||
} catch (Exception e) {throw e;} finally {connect.close();} |
|||
} |
|||
|
|||
|
|||
//-----------List of record for a TEAM and a day--------------------(TEAM)
|
|||
public List<Stat> getAllShops() throws Exception { |
|||
try { |
|||
// This will load the MySQL driver, each DB has its own driver
|
|||
Class.forName(DATABASE_DRIVER).newInstance(); |
|||
String url = "jdbc:mysql://localhost:3306/"+ DATABASE_NAME; |
|||
connect = DriverManager.getConnection(url, USERNAME, PASSWORD); |
|||
statement = connect.createStatement(); |
|||
|
|||
List<Stat> shopList = new ArrayList<Stat>(); |
|||
String test= Integer.toString(Calendar.DAY_OF_MONTH) + "/" + Integer.toString(Calendar.MONTH) + "/" + Integer.toString(Calendar.YEAR); |
|||
|
|||
resultSet = statement |
|||
.executeQuery( "SELECT * FROM " + TABLE_RECORDS + " WHERE Day = '"+test+"'"); |
|||
|
|||
while (resultSet.next()) { |
|||
Stat shop = new Stat(""); |
|||
double d = Double.parseDouble(resultSet.getString(4)); |
|||
int i = (int) d; |
|||
shop.setValRelative(i); |
|||
System.out.println(resultSet.getString(0) + "-" + resultSet.getString(1) + "-" + resultSet.getString(2) + "-" + resultSet.getString(3) + "-" + resultSet.getString(4)+ "-" + resultSet.getString(5)); |
|||
// Adding contact to list
|
|||
shopList.add(shop); |
|||
} |
|||
|
|||
return shopList; |
|||
|
|||
} catch (Exception e) {throw e;} finally {close();} |
|||
} |
|||
|
|||
|
|||
//-----------List of PLAYER stat record for a team and a day--------------------(PLAYER)
|
|||
public List<Stat> getRecordsList(Teams teams,int period) throws Exception { |
|||
try { |
|||
// This will load the MySQL driver, each DB has its own driver
|
|||
Class.forName(DATABASE_DRIVER).newInstance(); |
|||
String url = "jdbc:mysql://localhost:3306/"+ DATABASE_NAME; |
|||
connect = DriverManager.getConnection(url, USERNAME, PASSWORD); |
|||
statement = connect.createStatement(); |
|||
|
|||
List<Stat> records = new ArrayList<Stat>(); |
|||
|
|||
resultSet = statement |
|||
.executeQuery("SELECT * FROM " + TABLE_RECORDS + " WHERE " + KEY_TEAMID + " = " + teams.getID() + " AND " + KEY_PERIOD + " = " + period); |
|||
|
|||
while (resultSet.next()) { |
|||
|
|||
Stat stat = new Stat(resultSet.getString(KEY_STATNAME)); |
|||
stat.setRank(resultSet.getInt(KEY_RKSTAT)); |
|||
stat.setValRelative(resultSet.getFloat(KEY_VALSTAT)); |
|||
|
|||
records.add(stat); |
|||
} |
|||
|
|||
return records; |
|||
|
|||
} catch (Exception e) {throw e;} finally {close();} |
|||
} |
|||
|
|||
|
|||
//-----------REBUILD MADE / ATTEMPT from DB--------------------(TEAM)
|
|||
public String rebuildMA(Teams teams, String stat) throws Exception { |
|||
try { |
|||
// This will load the MySQL driver, each DB has its own driver
|
|||
Class.forName(DATABASE_DRIVER).newInstance(); |
|||
String url = "jdbc:mysql://localhost:3306/"+ DATABASE_NAME; |
|||
connect = DriverManager.getConnection(url, USERNAME, PASSWORD); |
|||
statement = connect.createStatement(); |
|||
|
|||
int sumTeamMA =0; |
|||
int sumTeamAT =0; |
|||
|
|||
resultSet = statement |
|||
.executeQuery("SELECT " + KEY_VALSTAT + " FROM " + TABLE_STATS + " WHERE " + KEY_STATNAME + " = '" + stat |
|||
+ "' AND " + KEY_TEAMID + " = " + teams.getID() + " AND " + KEY_SLOT + "<> 'Bench'"); |
|||
|
|||
while (resultSet.next()) { |
|||
|
|||
String[] decomp2 = resultSet.getString(KEY_VALSTAT).split("/"); |
|||
int val1 = (int) Float.parseFloat(decomp2[0]); |
|||
int val2 = (int) Float.parseFloat(decomp2[1]); |
|||
sumTeamMA += val1; |
|||
sumTeamAT += val2; |
|||
|
|||
} |
|||
|
|||
String valMadeAttempt = sumTeamMA + "/" + sumTeamAT; |
|||
|
|||
return valMadeAttempt; |
|||
|
|||
} catch (Exception e) {throw e;} finally {close();} |
|||
} |
|||
|
|||
|
|||
// --------------RETURN TOTAL OF RELATIVE POINT RANK FOR A TEAM----------------
|
|||
public float stat(int team, int period) throws Exception { |
|||
try { |
|||
// This will load the MySQL driver, each DB has its own driver
|
|||
Class.forName(DATABASE_DRIVER).newInstance(); |
|||
String url = "jdbc:mysql://localhost:3306/"+ DATABASE_NAME; |
|||
connect = DriverManager.getConnection(url, USERNAME, PASSWORD); |
|||
statement = connect.createStatement(); |
|||
|
|||
// Result set get the result of the SQL query
|
|||
resultSet = statement |
|||
.executeQuery("SELECT SUM(" + KEY_RKSTAT + ") FROM " + TABLE_RECORDS + " WHERE " + KEY_TEAMID + " = '" + team + "' AND " + KEY_PERIOD + " = '" + period +"'"); |
|||
|
|||
float value =0 ; |
|||
while (resultSet.next()) |
|||
{ |
|||
value = resultSet.getFloat(1); |
|||
} |
|||
|
|||
return value; |
|||
|
|||
} catch (Exception e) {throw e;} finally {close();} |
|||
} |
|||
|
|||
|
|||
//---------------DEL TEAM RECORD FROM THE DATABASE ------------
|
|||
public void delRecord(String dayOf) throws Exception { |
|||
try { |
|||
// This will load the MySQL driver, each DB has its own driver
|
|||
Class.forName(DATABASE_DRIVER).newInstance(); |
|||
String url = "jdbc:mysql://localhost:3306/"+ DATABASE_NAME; |
|||
connect = DriverManager.getConnection(url, USERNAME, PASSWORD); |
|||
statement = connect.createStatement(); |
|||
|
|||
String query = "DELETE FROM "+TABLE_RECORDS; |
|||
PreparedStatement preparedStmt = connect.prepareStatement(query); |
|||
preparedStmt.execute(); |
|||
|
|||
} catch (Exception e) {throw e;} finally {close();} |
|||
} |
|||
|
|||
|
|||
//-----------Test if day is RECORDED--------------------
|
|||
public int periodExist(int period) throws Exception { |
|||
try { |
|||
// This will load the MySQL driver, each DB has its own driver
|
|||
Class.forName(DATABASE_DRIVER).newInstance(); |
|||
String url = "jdbc:mysql://localhost:3306/"+ DATABASE_NAME; |
|||
connect = DriverManager.getConnection(url, USERNAME, PASSWORD); |
|||
statement = connect.createStatement(); |
|||
|
|||
resultSet = statement |
|||
.executeQuery( "SELECT COUNT(" + KEY_PERIOD + ") FROM " + TABLE_RECORDS + " WHERE " + KEY_PERIOD + " = " + period); |
|||
|
|||
int maxID = 0; |
|||
if (resultSet.next()) { |
|||
maxID = resultSet.getInt(1); |
|||
} |
|||
|
|||
return maxID; |
|||
|
|||
} catch (Exception e) {throw e;} finally {close();} |
|||
} |
|||
|
|||
//-----------Test if day is RECORDED--------------------
|
|||
public int countSLOT(Teams team, int slotID) throws Exception { |
|||
try { |
|||
// This will load the MySQL driver, each DB has its own driver
|
|||
Class.forName(DATABASE_DRIVER).newInstance(); |
|||
String url = "jdbc:mysql://localhost:3306/"+ DATABASE_NAME; |
|||
connect = DriverManager.getConnection(url, USERNAME, PASSWORD); |
|||
statement = connect.createStatement(); |
|||
|
|||
resultSet = statement |
|||
.executeQuery("SELECT COUNT(" + KEY_PERIOD + ") FROM " + TABLE_STATS + " WHERE " + KEY_TEAMID + " = " + team.getID() + " AND " + KEY_SLOTID + " = " + slotID); |
|||
|
|||
int slotCount = 0; |
|||
if (resultSet.next()) { |
|||
slotCount = resultSet.getInt(1); |
|||
} |
|||
|
|||
return slotCount; |
|||
|
|||
} catch (Exception e) {throw e;} finally {close();} |
|||
} |
|||
|
|||
|
|||
|
|||
// --------------RETURN TOTAL OF RELATIVE POINT RANK FOR A TEAM----------------
|
|||
public float statVal(int team, int period, String Stat) throws Exception { |
|||
try { |
|||
// This will load the MySQL driver, each DB has its own driver
|
|||
Class.forName(DATABASE_DRIVER).newInstance(); |
|||
String url = "jdbc:mysql://localhost:3306/"+ DATABASE_NAME; |
|||
connect = DriverManager.getConnection(url, USERNAME, PASSWORD); |
|||
statement = connect.createStatement(); |
|||
|
|||
// Result set get the result of the SQL query
|
|||
resultSet = statement |
|||
.executeQuery("SELECT " + KEY_VALSTAT+ " FROM " + TABLE_RECORDS + " WHERE " + KEY_TEAMID + " = '" + team + |
|||
"' AND " + KEY_PERIOD + " = '" + period +"' AND " + KEY_STATNAME + " = '" + Stat + "'" ); |
|||
|
|||
resultSet.next(); |
|||
|
|||
return Float.parseFloat(resultSet.getString(KEY_VALSTAT)); |
|||
|
|||
|
|||
} catch (Exception e) {throw e;} finally {close();} |
|||
} |
|||
|
|||
public void addTeam() throws Exception { |
|||
try { |
|||
// This will load the MySQL driver, each DB has its own driver
|
|||
Class.forName(DATABASE_DRIVER).newInstance(); |
|||
String url = "jdbc:mysql://localhost:3306/"+ DATABASE_NAME; |
|||
connect = DriverManager.getConnection(url, USERNAME, PASSWORD); |
|||
statement = connect.createStatement(); |
|||
|
|||
// PreparedStatements can use variables and are more efficient
|
|||
preparedStatement = connect |
|||
.prepareStatement("insert into teams values (?, ?)"); |
|||
// "myuser, webpage, datum, summary, COMMENTS from feedback.comments");
|
|||
// Parameters start with 1
|
|||
preparedStatement.setInt(1, 2); |
|||
preparedStatement.setString(2, "TestEmail"); |
|||
preparedStatement.executeUpdate(); |
|||
|
|||
} catch (Exception e) {throw e;} finally {close();} |
|||
} |
|||
|
|||
|
|||
// ------------RETURN LAST DAY RECORDED----------------
|
|||
public Integer getLastPeriod() throws Exception { |
|||
try { |
|||
// This will load the MySQL driver, each DB has its own driver
|
|||
Class.forName(DATABASE_DRIVER).newInstance(); |
|||
String url = "jdbc:mysql://localhost:3306/"+ DATABASE_NAME; |
|||
connect = DriverManager.getConnection(url, USERNAME, PASSWORD); |
|||
statement = connect.createStatement(); |
|||
|
|||
// Result set get the result of the SQL query
|
|||
resultSet = statement |
|||
.executeQuery("SELECT MAX("+ KEY_PERIOD + ") FROM " + TABLE_RECORDS); |
|||
|
|||
int maxID = 0; |
|||
if (resultSet.next()) { |
|||
maxID = resultSet.getInt(1); |
|||
} |
|||
|
|||
return maxID; |
|||
|
|||
} catch (Exception e) {throw e;} finally {close();} |
|||
} |
|||
|
|||
public Integer nbDay() throws Exception { |
|||
try { |
|||
// This will load the MySQL driver, each DB has its own driver
|
|||
Class.forName(DATABASE_DRIVER).newInstance(); |
|||
String url = "jdbc:mysql://localhost:3306/"+ DATABASE_NAME; |
|||
connect = DriverManager.getConnection(url, USERNAME, PASSWORD); |
|||
statement = connect.createStatement(); |
|||
|
|||
// Result set get the result of the SQL query
|
|||
resultSet = statement |
|||
.executeQuery("SELECT COUNT(DISTINCT " + KEY_PERIOD + ") FROM " + TABLE_RECORDS); |
|||
|
|||
|
|||
int maxID = 0; |
|||
if (resultSet.next()) { |
|||
maxID = resultSet.getInt(1); |
|||
} |
|||
return maxID; |
|||
|
|||
|
|||
} catch (Exception e) {throw e;} finally {close();} |
|||
} |
|||
|
|||
public void readTeam() throws Exception { |
|||
try { |
|||
// This will load the MySQL driver, each DB has its own driver
|
|||
Class.forName(DATABASE_DRIVER).newInstance(); |
|||
String url = "jdbc:mysql://localhost:3306/"+ DATABASE_NAME; |
|||
connect = DriverManager.getConnection(url, USERNAME, PASSWORD); |
|||
statement = connect.createStatement(); |
|||
|
|||
// Result set get the result of the SQL query
|
|||
resultSet = statement |
|||
.executeQuery("select * from teams"); |
|||
|
|||
writeResultSet(resultSet); |
|||
|
|||
} catch (Exception e) {throw e;} finally {close();} |
|||
} |
|||
|
|||
public Integer dayRecorded(Teams teams,int period) throws Exception { |
|||
try { |
|||
// This will load the MySQL driver, each DB has its own driver
|
|||
Class.forName(DATABASE_DRIVER).newInstance(); |
|||
String url = "jdbc:mysql://localhost:3306/"+ DATABASE_NAME; |
|||
connect = DriverManager.getConnection(url, USERNAME, PASSWORD); |
|||
statement = connect.createStatement(); |
|||
|
|||
resultSet = statement |
|||
.executeQuery("SELECT COUNT(" + KEY_PERIOD + ") FROM " + TABLE_STATS + " WHERE " + KEY_TEAMID + " = " + teams.getID() + " AND " + KEY_PERIOD + " = " + period); |
|||
|
|||
int maxID = 0; |
|||
if (resultSet.next()) { |
|||
maxID = resultSet.getInt(1); |
|||
} |
|||
|
|||
return maxID; |
|||
|
|||
} catch (Exception e) {throw e;} finally {close();} |
|||
} |
|||
|
|||
|
|||
//---------------DEL PLAYER STAT RECORD from THE DATABASE ------------
|
|||
public void delStat(Teams teams, int period) throws Exception { |
|||
try { |
|||
// This will load the MySQL driver, each DB has its own driver
|
|||
Class.forName(DATABASE_DRIVER).newInstance(); |
|||
String url = "jdbc:mysql://localhost:3306/"+ DATABASE_NAME; |
|||
connect = DriverManager.getConnection(url, USERNAME, PASSWORD); |
|||
|
|||
String query = "DELETE FROM " + TABLE_STATS + " WHERE " + KEY_TEAMID + " = " + teams.getID() + |
|||
" AND " + KEY_PERIOD + " = " + period; |
|||
PreparedStatement preparedStmt = connect.prepareStatement(query); |
|||
preparedStmt.execute(); |
|||
|
|||
|
|||
} catch (Exception e) {throw e;} finally {close();} |
|||
} |
|||
|
|||
|
|||
private void writeResultSet(ResultSet resultSet) throws SQLException { |
|||
// ResultSet is initially before the first data set
|
|||
while (resultSet.next()) { |
|||
// It is possible to get the columns via name
|
|||
// also possible to get the columns via the column number
|
|||
// which starts at 1
|
|||
// e.g. resultSet.getSTring(2);
|
|||
String user = resultSet.getString("team"); |
|||
System.out.println("User: " + user); |
|||
|
|||
} |
|||
} |
|||
|
|||
private void readStats() throws Exception { |
|||
// ResultSet is initially before the first data set
|
|||
try { |
|||
Class.forName(DATABASE_DRIVER).newInstance(); |
|||
String url = "jdbc:mysql://localhost:3306/"+ DATABASE_NAME; |
|||
connect = DriverManager.getConnection(url, USERNAME, PASSWORD); |
|||
statement = connect.createStatement(); |
|||
|
|||
// Result set get the result of the SQL query
|
|||
resultSet = statement |
|||
.executeQuery("SELECT * FROM " + TABLE_RECORDS ); |
|||
|
|||
|
|||
while (resultSet.next()) { |
|||
// It is possible to get the columns via name
|
|||
// also possible to get the columns via the column number
|
|||
// which starts at 1
|
|||
// e.g. resultSet.getSTring(2);
|
|||
System.out.println("Team id : " + resultSet.getString(KEY_TEAMID) + " Stat : " + resultSet.getString(KEY_STATNAME) + " Value : " + resultSet.getString(KEY_RKSTAT) + " Period : " + resultSet.getString(KEY_PERIOD)); |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
} catch (Exception e) {throw e;} finally {close();} |
|||
|
|||
} |
|||
|
|||
// You need to close the resultSet
|
|||
private static void close() { |
|||
try { |
|||
if (resultSet != null) { |
|||
resultSet.close(); |
|||
} |
|||
|
|||
if (statement != null) { |
|||
statement.close(); |
|||
} |
|||
|
|||
if (connect != null) { |
|||
connect.close(); |
|||
} |
|||
} catch (Exception e) { |
|||
|
|||
} |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,219 @@ |
|||
package functions; |
|||
|
|||
import java.text.DecimalFormat; |
|||
import java.util.ArrayList; |
|||
import java.util.Collections; |
|||
|
|||
import call_pages.CALL_Fantasy; |
|||
import objects.Player; |
|||
import objects.Stat; |
|||
import objects.Teams; |
|||
|
|||
/** |
|||
* Created by LeJay on 05.02.2017. |
|||
*/ |
|||
|
|||
public class PROJ_analysis extends CALL_Fantasy { //called from FA_test or btnProjection or btnTeam
|
|||
|
|||
private Teams team; |
|||
int perdiod; |
|||
private int nbGame; |
|||
|
|||
|
|||
public PROJ_analysis(){ |
|||
//calculate();
|
|||
} // also fill player RK in team if not yet filled
|
|||
|
|||
public static void calculate(){ |
|||
|
|||
float total =0; |
|||
final DecimalFormat f = new DecimalFormat("0.#"); |
|||
final DecimalFormat in = new DecimalFormat("0.##"); |
|||
|
|||
l1.nbGP = l1.getNbDaysPlayed()/2; |
|||
l1.nbGR = l1.nbGS - l1.nbGP; |
|||
|
|||
//-------
|
|||
for(Teams teamX : l1.leagueTeams) { |
|||
|
|||
float TeamRemain = (820 - teamX.getGamesPlayed())/10; |
|||
|
|||
//ne pas recalculer le total de projection si le joueur n'est pas impliqué dans un trade
|
|||
if(teamX.getInTrade() || teamX.getProjRK()==(double) 0.0) { |
|||
//-----------Calculate end season projection for each stat of each PLAYER-------ALL
|
|||
for (Player playerX : teamX.players) { |
|||
|
|||
//calculate only if not yet done for this player
|
|||
if(playerX.stats.get(0).getValProjection()==null && playerX.teamID == teamX.getID()) { |
|||
for (Stat statX : playerX.stats) { |
|||
if (isNumeric(statX.getStatVal())) { |
|||
float valProj = Float.parseFloat(statX.getStatVal()) * TeamRemain; |
|||
statX.setValProjection(Float.toString(valProj));//remaining points
|
|||
} else { |
|||
statX.setValProjection("0"); |
|||
} |
|||
if (statX.getStatVal().contains("/")) { |
|||
String[] decomp = statX.getStatVal().split("/"); |
|||
if (isNumeric(decomp[0])) { |
|||
float valProj1 = Float.parseFloat(decomp[0]) * TeamRemain; |
|||
float valProj2 = Float.parseFloat(decomp[1]) * TeamRemain; |
|||
statX.setValProjection(valProj1 + "/" + valProj2);//remaining points
|
|||
} else { |
|||
statX.setValProjection("0/0"); |
|||
} |
|||
} |
|||
|
|||
if (statX.getName().equals("PTS")) { |
|||
break; |
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
//----------------add projection totals from players to team stats
|
|||
for (Stat teamStatX : teamX.stats) { |
|||
|
|||
if (teamStatX != null) { |
|||
int statCtr = 0; //3PM is 4th stat in playerStat
|
|||
for (statCtr = 0; statCtr < l1.loadStatBasePlayer.size(); statCtr++) |
|||
if (teamStatX.getName().equals(l1.loadStatBasePlayer.get(statCtr).getName())) |
|||
break; |
|||
|
|||
if (!teamStatX.getName().contains("%")) { |
|||
if (!teamStatX.getName().contains("/")) { |
|||
float sumPlayerProj = 0; |
|||
for (Player playerX : teamX.players){ |
|||
if (playerX.teamID == teamX.getID() && playerX.isToCount) { |
|||
sumPlayerProj += (int) Float.parseFloat(playerX.stats.get(statCtr).getValProjection()); |
|||
System.out.println(playerX.getnom() + " -added va- " + sumPlayerProj); |
|||
} |
|||
} |
|||
|
|||
|
|||
|
|||
float valProjection = Float.parseFloat(teamStatX.getValSeason()) + sumPlayerProj; |
|||
teamStatX.setValProjection(Float.toString(valProjection)); |
|||
} else { |
|||
|
|||
//sum player stats just created
|
|||
float sumPlayerProj1 = 0; |
|||
float sumPlayerProj2 = 0; |
|||
for (Player playerX : teamX.players) { |
|||
if (playerX.teamID == teamX.getID() && playerX.isToCount){ |
|||
String[] decomp = playerX.stats.get(statCtr).getValProjection().split("/"); |
|||
float valProj1 = Float.parseFloat(decomp[0]); |
|||
float valProj2 = Float.parseFloat(decomp[1]); |
|||
sumPlayerProj1 += valProj1; |
|||
sumPlayerProj2 += valProj2; |
|||
} |
|||
} |
|||
|
|||
//need loaded info from db
|
|||
//apply projection to % and /
|
|||
String[] decomp2 = teamStatX.getValSeason().split("/"); |
|||
int valSeas1 = (int) Float.parseFloat(decomp2[0]); |
|||
int valSeas2 = (int) Float.parseFloat(decomp2[1]); |
|||
sumPlayerProj1 += valSeas1; |
|||
sumPlayerProj2 += valSeas2; |
|||
String valProjection = sumPlayerProj1 + "/" + sumPlayerProj2; |
|||
float valProjPourcent = sumPlayerProj1 / sumPlayerProj2 * 100; |
|||
//float valProjPourcent = Float.parseFloat(teamX.stats.get(statCtr).getValSeason());
|
|||
//statCtr points to % stat
|
|||
teamX.stats.get(statCtr).setValProjection(Float.toString(valProjPourcent)); |
|||
teamStatX.setValProjection(valProjection); |
|||
|
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
|||
} |
|||
|
|||
|
|||
//----------------add projection RANK to team stats
|
|||
ArrayList<Stat> arrVal = new ArrayList<Stat>(); |
|||
// go through all stats and all teams
|
|||
for (int j = 0; j < l1.loadStatBaseTeam.size(); j++) { |
|||
if(!l1.loadStatBaseTeam.get(j).getName().contains("/")){ |
|||
arrVal.clear(); |
|||
//---------------add team stats to array
|
|||
for (int i = 0; i < l1.nbTeams; i++) { |
|||
|
|||
System.out.println(l1.leagueTeams.get(i).stats.get(j).getValProjection()); |
|||
l1.leagueTeams.get(i).stats.get(j).setValToRank(Float.parseFloat(l1.leagueTeams.get(i).stats.get(j).getValProjection())); |
|||
arrVal.add(l1.leagueTeams.get(i).stats.get(j)); |
|||
} |
|||
|
|||
//for (int i = 0; i < arrVal.size(); i++) {System.out.println(arrVal.get(i).getName() + "/" + arrVal.get(i).getValProjection());}
|
|||
if (l1.leagueTeams.get(0).stats.get(j).getName().equals("TO")) { |
|||
Collections.sort(arrVal); |
|||
} else { |
|||
Collections.sort(arrVal, Collections.reverseOrder()); |
|||
} |
|||
//for (int i = 0; i < arrVal.size(); i++) {System.out.println(arrVal.get(i).getName() + "/" + arrVal.get(i).getValProjection());}
|
|||
RANKS_fill.fillRANK("projection",arrVal,null,null); |
|||
} |
|||
} |
|||
|
|||
//-------------fill team ranks---------------
|
|||
ArrayList<Teams> arrVal2 = new ArrayList<Teams>(); |
|||
for (int i = 0; i < l1.nbTeams; i++) { |
|||
//fill total relative pts
|
|||
Double tot = 0.0; |
|||
for (int j = 0; j <= l1.loopStatsTeam; j++) { |
|||
if (!l1.loadStatBaseTeam.get(j).getName().contains("/")) { |
|||
tot += l1.leagueTeams.get(i).stats.get(j).getProjectedRK(); |
|||
} |
|||
} |
|||
l1.leagueTeams.get(i).setProjTot(tot); |
|||
l1.leagueTeams.get(i).setValToRank((float)l1.leagueTeams.get(i).getProjTot()); |
|||
arrVal2.add(l1.leagueTeams.get(i)); |
|||
} |
|||
//for (int i = 0; i < arrVal2.size(); i++)System.out.println(arrVal2.get(i).getTotalrotPtsRel());
|
|||
Collections.sort(arrVal2); |
|||
//for (int i = 0; i < arrVal2.size(); i++)System.out.println(arrVal2.get(i).getTotalrotPtsRel());
|
|||
RANKS_fill.fillRANK("teamProjection",null,arrVal2,null); |
|||
|
|||
//SHOW_tab.printTeams();
|
|||
//btn_Team.setEnabled(true);
|
|||
|
|||
//format stats for display
|
|||
for(Teams teamX : l1.leagueTeams) { |
|||
for (Stat statX : teamX.stats) { |
|||
if(statX.getName().contains("/")) { |
|||
String decomp[] = statX.getValProjection().split("/"); |
|||
float val1 = Float.parseFloat(decomp[0]); |
|||
float val2 = Float.parseFloat(decomp[1]); |
|||
statX.setValProjection((int)val1 + "/" + (int)val2); |
|||
}else if(statX.getName().contains("%")) { |
|||
float val = Float.parseFloat(statX.getValProjection()); |
|||
statX.setValProjection(in.format(val)); |
|||
}else { |
|||
float val1 = Float.parseFloat(statX.getValProjection()); |
|||
statX.setValProjection(String.valueOf((int)val1)); |
|||
} |
|||
} |
|||
|
|||
//teamX.setProjRK(Double.parseDouble(f.format(teamX.getProjRK())));
|
|||
//teamX.setProjTot(Double.parseDouble(f.format(teamX.getProjTot())));
|
|||
} |
|||
} |
|||
|
|||
public static boolean isNumeric(String str) |
|||
{ |
|||
try |
|||
{ |
|||
double d = Double.parseDouble(str); |
|||
} |
|||
catch(NumberFormatException nfe) |
|||
{ |
|||
return false; |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
@ -0,0 +1,317 @@ |
|||
package functions; |
|||
|
|||
|
|||
import java.text.DecimalFormat; |
|||
import java.util.ArrayList; |
|||
import java.util.Collections; |
|||
|
|||
import call_pages.CALL_Fantasy; |
|||
import objects.League; |
|||
import objects.Player; |
|||
import objects.Stat; |
|||
import objects.Teams; |
|||
|
|||
/** |
|||
* Created by LeJay on 14.02.2017. |
|||
*/ |
|||
|
|||
public class RANKS_fill extends CALL_Fantasy { |
|||
private RANKS_fill() { |
|||
|
|||
} |
|||
// //-------------------------------------------------------------fill stat ranks TEST
|
|||
// public static float[] fillStatRankTEST(){
|
|||
// double pts = l1.nbTeams;
|
|||
// float[] arrVal = new float[l1.nbTeams];
|
|||
// // go through all stats and all teams
|
|||
// for (int j = 0; j < l1.loopStatsTeam; j++) {
|
|||
// if(!l1.loadStatBaseTeam.get(j).getName().contains("/")){
|
|||
// //---------------add team stats to array
|
|||
// for (int i = 0; i < l1.nbTeams; i++) {
|
|||
// arrVal.get(i) = leagueTeams.get(i).stats.get(j).getValRelative();
|
|||
// }
|
|||
// double[] rank = rankFantasy(arrVal);
|
|||
//
|
|||
// for (int i = 0; i < rank.length; i++)
|
|||
// System.out.println(""+rank.get(i));
|
|||
//
|
|||
// for (int i = 0; i < l1.nbTeams; i++) {
|
|||
// if(!leagueTeams.get(i).stats.get(j).getName().equals("TO"))
|
|||
// leagueTeams.get(i).stats.get(j).setRank(rank.get(i));
|
|||
// else
|
|||
// leagueTeams.get(i).stats.get(j).setRank(l1.nbTeams+1-rank.get(i));
|
|||
// }
|
|||
// }
|
|||
// }
|
|||
// return arrVal;
|
|||
// }
|
|||
//
|
|||
// //-------------------------------------------------------------fill team ranks TEST
|
|||
// public static float[] fillTeamRankTEST(){
|
|||
//
|
|||
// float[] arrVal2 = new float[l1.nbTeams];
|
|||
// for (int i = 0; i < l1.nbTeams; i++) {
|
|||
// //fill total relative pts
|
|||
// Double tot = 0.0;
|
|||
// for (int j = 0; j < l1.loopStatsTeam; j++) {
|
|||
// if(!l1.loadStatBaseTeam.get(j).getName().contains("/")){
|
|||
// tot += leagueTeams.get(i).stats.get(j).getRank();
|
|||
// }
|
|||
// }
|
|||
// leagueTeams.get(i).setTotalrotPtsRel(tot);
|
|||
// arrVal2.get(i) = (float) leagueTeams.get(i).getTotalrotPtsRel();
|
|||
// }
|
|||
// double[] rank = rankFantasy(arrVal2);
|
|||
//
|
|||
// for (int i = 0; i < rank.length; i++)
|
|||
// System.out.println(""+rank.get(i));
|
|||
//
|
|||
// for (int i = 0; i < l1.nbTeams; i++) {
|
|||
// leagueTeams.get(i).setRelativeRK(rank.get(i));
|
|||
// }
|
|||
// return arrVal2;
|
|||
// }
|
|||
|
|||
//-------------------------------------------------------------fill ranks
|
|||
public static void fillRANK(String type, ArrayList<Stat> arrStat, ArrayList<Teams> arrTeam , ArrayList<Player> arrPlayer) { |
|||
|
|||
int nbLoop =0; |
|||
if(arrStat!=null) nbLoop = arrStat.size(); |
|||
if(arrTeam!=null) nbLoop = arrTeam.size(); |
|||
if(arrPlayer!=null) nbLoop = arrPlayer.size(); |
|||
|
|||
int pts = nbLoop; |
|||
|
|||
for (int k = 0; k < nbLoop; k++) { |
|||
switch (type) { |
|||
case "relative":arrStat.get(k).setRank(pts);break; |
|||
case "projection":arrStat.get(k).setProjectedRK(pts);break; |
|||
case "teamRelative":arrTeam.get(k).setRelativeRK(pts);break; |
|||
case "teamProjection":arrTeam.get(k).setProjRK(pts);break; |
|||
case "playerINteam":arrPlayer.get(k).setInterRK(pts); |
|||
//si le rank du player est plus grand que le nombre de player a compter
|
|||
if(pts>l1.nbPtoCnt){arrPlayer.get(k).isToCount = false;} |
|||
else{arrPlayer.get(k).isToCount = true;} |
|||
break; |
|||
} |
|||
pts -= 1; |
|||
} |
|||
for (int k = 0; k < nbLoop; k++) { |
|||
int nbSameVal = 1; |
|||
for (int sameVal = 1; sameVal < nbLoop; sameVal++) |
|||
if (k + sameVal < nbLoop) |
|||
switch (type) { |
|||
case "relative": |
|||
if (arrStat.get(k).getValRelative() == arrStat.get(k + sameVal).getValRelative()) |
|||
nbSameVal++;break; |
|||
case "projection": |
|||
if (arrStat.get(k).getValProjection() == arrStat.get(k + sameVal).getValProjection()) |
|||
nbSameVal++;break; |
|||
case "teamRelative": |
|||
if (arrTeam.get(k).getTotalrotPtsRel() == arrTeam.get(k + sameVal).getTotalrotPtsRel()) |
|||
nbSameVal++;break; |
|||
case "teamProjection": |
|||
if (arrTeam.get(k).getProjTot() == arrTeam.get(k + sameVal).getProjTot()) |
|||
nbSameVal++;break; |
|||
case "playerINteam": |
|||
if (arrPlayer.get(k).getInterRK() == arrPlayer.get(k + sameVal).getInterVal()) |
|||
nbSameVal++;break; |
|||
} |
|||
|
|||
if (nbSameVal != 1) { |
|||
double nbpt = 0.0; |
|||
for (int z = 0; z < nbSameVal; z++) { |
|||
if (k + z < nbLoop) |
|||
switch (type) { |
|||
case "relative":nbpt += arrStat.get(k + z).getRank();break; |
|||
case "projection":nbpt += arrStat.get(k + z).getProjectedRK();break; |
|||
case "teamRelative":nbpt += arrTeam.get(k + z).getRelativeRK();break; |
|||
case "teamProjection":nbpt += arrTeam.get(k + z).getProjRK();break; |
|||
case "playerINteam":nbpt += arrPlayer.get(k + z).getInterRK();break; |
|||
} |
|||
} |
|||
double newRank = nbpt / nbSameVal; |
|||
for (int z = 0; z < nbSameVal; z++) { |
|||
if (k + z < nbLoop) |
|||
switch (type) { |
|||
case "relative":arrStat.get(k + z).setRank(newRank);break; |
|||
case "projection":arrStat.get(k + z).setProjectedRK(newRank);break; |
|||
case "teamRelative":arrTeam.get(k + z).setRelativeRK(newRank);break; |
|||
case "teamProjection":arrTeam.get(k + z).setProjRK(newRank);break; |
|||
case "playerINteam":arrPlayer.get(k + z).setInterRK(newRank);break; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
/* switch (type) { |
|||
case "relative":for (int i = 0; i < arrStat.size(); i++)System.out.println(arrStat.get(i).getRank());;break; |
|||
case "projection":for (int i = 0; i < arrStat.size(); i++)System.out.println(arrStat.get(i).getProjectedRK());;break; |
|||
case "teamRelative":for (int i = 0; i < arrTeam.size(); i++)System.out.println(arrTeam.get(i).getRelativeRK());;break; |
|||
case "teamProjection":for (int i = 0; i < arrTeam.size(); i++)System.out.println(arrTeam.get(i).getProjRK());;break; |
|||
case "playerINteam":for (int i = 0; i < arrPlayer.size(); i++)System.out.println(arrPlayer.get(i).getInterVal());;break; |
|||
}*/ |
|||
} |
|||
|
|||
//-------------------------------------------------------------fill stat ranks
|
|||
public static void fillStatRank(){ |
|||
double pts = l1.nbTeams; |
|||
ArrayList<Stat> arrVal = new ArrayList<Stat>(); |
|||
// go through all stats and all teams
|
|||
for (int j = 0; j <= l1.loopStatsTeam; j++) { |
|||
if(!l1.loadStatBaseTeam.get(j).getName().contains("/")){ |
|||
arrVal.clear(); |
|||
//---------------add team stats to array
|
|||
for (int i = 0; i < l1.nbTeams; i++) { |
|||
l1.leagueTeams.get(i).stats.get(j).setValToRank(l1.leagueTeams.get(i).stats.get(j).getValRelative()* 10000); |
|||
arrVal.add(l1.leagueTeams.get(i).stats.get(j)); |
|||
} |
|||
//for (int i = 0; i < arrVal.size(); i++) {System.out.println(arrVal.get(i).getName() + "/" + arrVal.get(i).getValRelative());}
|
|||
if (l1.leagueTeams.get(0).stats.get(j).getName().equals("TO")) { |
|||
Collections.sort(arrVal); |
|||
} else { |
|||
Collections.sort(arrVal, Collections.reverseOrder()); |
|||
} |
|||
//for (int i = 0; i < arrVal.size(); i++) {System.out.println(arrVal.get(i).getName() + "/" + arrVal.get(i).getValRelative());}
|
|||
fillRANK("relative",arrVal,null,null); |
|||
} |
|||
} |
|||
} |
|||
|
|||
//-------------------------------------------------------------------FILL TEAM RANK
|
|||
public static void fillTeamRank() { |
|||
ArrayList<Teams> arrVal2 = new ArrayList<Teams>(); |
|||
for (int i = 0; i < l1.nbTeams; i++) { |
|||
//fill total relative pts
|
|||
Double tot = 0.0; |
|||
for (int j = 0; j <= l1.loopStatsTeam; j++) { |
|||
if (!l1.loadStatBaseTeam.get(j).getName().contains("/")) { |
|||
tot += l1.leagueTeams.get(i).stats.get(j).getRank(); |
|||
} |
|||
} |
|||
l1.leagueTeams.get(i).setTotalrotPtsRel(tot); |
|||
l1.leagueTeams.get(i).setValToRank((float)l1.leagueTeams.get(i).getTotalrotPtsRel()); |
|||
arrVal2.add(l1.leagueTeams.get(i)); |
|||
} |
|||
//for (int i = 0; i < arrVal2.size(); i++)System.out.println(arrVal2.get(i).getTotalrotPtsRel());
|
|||
Collections.sort(arrVal2); |
|||
//for (int i = 0; i < arrVal2.size(); i++)System.out.println(arrVal2.get(i).getTotalrotPtsRel());
|
|||
fillRANK("teamRelative",null,arrVal2,null); |
|||
} |
|||
|
|||
|
|||
//--------------------------------------------------FILL PLAYER RANK IN TEAM---need projection & load from db
|
|||
public static void fillPlayerRKinTeam(Teams team) {//called from btn teamlist
|
|||
float minP = 100; |
|||
//fill % impact difference in stat->valRot
|
|||
for (Player playerX :team.players) { |
|||
if (!playerX.stats.get(0).getStatVal().contains("--")){ |
|||
for (int j = 0; j < l1.nbStatsPlayer; j++) { |
|||
if (l1.loadStatBasePlayer.get(j).getName().contains("/")) { |
|||
String[] decomp = playerX.stats.get(j).getStatVal().split("/"); |
|||
//get remaining attempt
|
|||
float remPlayerAttempt = Float.parseFloat(decomp[1]); |
|||
//get % of player
|
|||
float pourPlayer = Float.parseFloat(playerX.stats.get(j+1).getStatVal()); |
|||
//define impact
|
|||
float remMadePlayer = remPlayerAttempt * pourPlayer; |
|||
float pourcTeamProj = Float.parseFloat(team.stats.get(j).getValProjection()); |
|||
float pourcDiff = pourPlayer - pourcTeamProj; |
|||
float value = pourcDiff * remPlayerAttempt; |
|||
playerX.stats.get(j).setValRot(value); // rot used to store %impact
|
|||
if (value < minP) minP = value; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
//loop to add min val to all difference and increment total val
|
|||
float sumVals = 0; |
|||
for (Player playerX :team.players) { |
|||
if (!playerX.stats.get(0).getStatVal().contains("--")) { |
|||
for (int j = 0; j < l1.nbStatsPlayer; j++) { |
|||
if (l1.loadStatBasePlayer.get(j).getName().contains("/")) { |
|||
playerX.stats.get(j).setValRot(playerX.stats.get(j).getValRot() + minP); // rot used to store %impact
|
|||
sumVals += playerX.stats.get(j).getValRot() + minP; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
//loop to set % of impact
|
|||
for (Player playerX :team.players) { |
|||
if (!playerX.stats.get(0).getStatVal().contains("--")) { |
|||
for (int j = 0; j < l1.nbStatsPlayer; j++) { |
|||
if (l1.loadStatBasePlayer.get(j).getName().contains("/")) { |
|||
playerX.stats.get(j).setValRot(playerX.stats.get(j).getValRot() / sumVals); // rot used to store %impact
|
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
ArrayList<Player> arrVal3 = new ArrayList<Player>(); |
|||
for (Player playerX :team.players) { |
|||
|
|||
if (!playerX.stats.get(0).getStatVal().contains("--")) { |
|||
//fill impact of player in overall result %
|
|||
float tot = (float) 0.0; |
|||
float totPourc = (float) 0; |
|||
//loop until nb stat player
|
|||
for (int j = 0; j < l1.nbStatsTeam; j++) { |
|||
if (!playerX.stats.get(j).getName().contains("/")) { |
|||
if (playerX.stats.get(j).getName().contains("%")) { |
|||
totPourc = (float) playerX.stats.get(j).getValRot(); |
|||
} else {// % equals to remain player / remain team
|
|||
String teamRemain = team.stats.get(j).getValProjection(); |
|||
float valProj = Float.parseFloat(playerX.stats.get(j).getValProjection()); |
|||
totPourc = valProj / Float.parseFloat(teamRemain); |
|||
} |
|||
// end value is a % of project stat PK points
|
|||
totPourc = (float) team.stats.get(j).getProjectedRK() * totPourc *10; |
|||
//ajoute la valeur du stat
|
|||
playerX.stats.get(j).setValRot(totPourc); |
|||
//incremente pour la valeur totale du joueur
|
|||
tot += totPourc; |
|||
} |
|||
} |
|||
// ajoute valeur au joueur & ajoute le joueur a l'array
|
|||
playerX.setInterVal(tot); |
|||
playerX.setValToRank(playerX.getInterVal()); |
|||
arrVal3.add(playerX); |
|||
} |
|||
} |
|||
//for (int i = 0; i < arrVal2.size(); i++)System.out.println(arrVal2.get(i).getTotalrotPtsRel());
|
|||
Collections.sort(arrVal3); |
|||
//for (int i = 0; i < arrVal2.size(); i++)System.out.println(arrVal2.get(i).getTotalrotPtsRel());
|
|||
fillRANK("playerINteam",null,null,arrVal3); |
|||
|
|||
} |
|||
|
|||
//--------------------------------------------------FILL PLAYER RANK IN TEAM---no need projection
|
|||
public static void fillPlayerRKinTeamOWN(Teams team) {//called after import
|
|||
ArrayList<Player> arrVal3 = new ArrayList<Player>(); |
|||
for (Player playerX :team.players) { |
|||
if (!playerX.stats.get(0).getStatVal().contains("--")) { |
|||
for(Stat stat : playerX.stats) { |
|||
if(stat.getName().equals("%OWN")){ |
|||
playerX.setValToRank(Float.parseFloat(stat.getStatVal())); |
|||
arrVal3.add(playerX); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
//for (int i = 0; i < arrVal2.size(); i++)System.out.println(arrVal2.get(i).getTotalrotPtsRel());
|
|||
Collections.sort(arrVal3); |
|||
//for (int i = 0; i < arrVal2.size(); i++)System.out.println(arrVal2.get(i).getTotalrotPtsRel());
|
|||
fillRANK("playerINteam",null,null,arrVal3); |
|||
} |
|||
|
|||
|
|||
//---------------------------------------------------------round 2 decimals
|
|||
public Float roundTwoDecimals(double d) { |
|||
DecimalFormat twoDForm = new DecimalFormat("#.##"); |
|||
return Float.valueOf(twoDForm.format(d)); |
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
@ -0,0 +1,282 @@ |
|||
package functions; |
|||
|
|||
import java.text.DecimalFormat; |
|||
import java.util.ArrayList; |
|||
import java.util.Collection; |
|||
import java.util.Collections; |
|||
import java.util.Comparator; |
|||
import java.util.List; |
|||
|
|||
import call_pages.CALL_Fantasy; |
|||
import objects.League; |
|||
import objects.Player; |
|||
import objects.Stat; |
|||
import objects.Teams; |
|||
|
|||
/** |
|||
* Created by LeJay on 22.02.2017. |
|||
*/ |
|||
|
|||
public class TRADE_test extends CALL_Fantasy { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
public static ArrayList<ArrayList<Stat>> mainTRADE = new ArrayList<>(); |
|||
public static double maxPts = 0.0; |
|||
public static double maxRK = 0.0; |
|||
public static int sortKey; |
|||
int nbPlay = 0; |
|||
|
|||
public static ArrayList<ArrayList<Stat>> SetTrade(Teams team1,Teams team2){ |
|||
|
|||
int nbt1PSelected = 0; |
|||
int nbt2PSelected = 0; |
|||
mainTRADE = new ArrayList<>(); |
|||
team1.setInTrade(true); |
|||
team2.setInTrade(true); |
|||
|
|||
// test si joueur joueur séléctioné dans équipe
|
|||
for (Player playerX : team1.players) { |
|||
if(playerX.inTrade && playerX.teamID == team1.getID()){ |
|||
nbt1PSelected +=1; |
|||
} |
|||
} |
|||
for (Player playerX : team2.players) { |
|||
if(playerX.inTrade && playerX.teamID == team2.getID()){ |
|||
nbt2PSelected +=1; |
|||
} |
|||
} |
|||
|
|||
// si joueur selectionne dans les 2 equipes
|
|||
if (nbt1PSelected>0 && nbt2PSelected>0) { |
|||
mainTRADE.add(Execute(team1, team2,true)); |
|||
// si joueur selectionne seulement dans team 1 -> teste toute les combi de T2
|
|||
}else if (nbt1PSelected>0){ |
|||
recursiveOtherT(0,0,nbt1PSelected,team1,team2,false,true); |
|||
// si joueur selectionne seulement dand team 2-> teste toute les combi de T1
|
|||
}else if (nbt2PSelected>0){ |
|||
recursiveOtherT(0,0,nbt2PSelected,team2,team1,true,true); |
|||
// si aucun joueur selectionné teste toutes les combi entre les 2 joueurs
|
|||
}else { |
|||
|
|||
for (Player playerX : team1.players) { |
|||
if(playerX.teamID == team1.getID()){ |
|||
nbt1PSelected +=1; |
|||
} |
|||
} |
|||
//---false ne compte pas les resultats negatif
|
|||
for (int x=nbt1PSelected-1;x>nbt1PSelected-3;x--) { |
|||
recursiveTeam(0,0,nbt1PSelected-x,team1,team2, false); |
|||
} |
|||
|
|||
/* if(mainTRADE.size()<5) { |
|||
for (int x=nbt1PSelected-1;x>nbt1PSelected-3;x--) { |
|||
recursiveTeam(0,0,nbt1PSelected-x,team1,team2, true); |
|||
} |
|||
}*/ |
|||
|
|||
} |
|||
|
|||
sortKey = l1.loopStatsTeam + 6; |
|||
Collections.sort(mainTRADE, new ListOfStatComparator()); |
|||
sortKey = l1.loopStatsTeam + 2; |
|||
Collections.sort(mainTRADE, new ListOfStatComparator()); |
|||
sortKey = l1.loopStatsTeam + 3; |
|||
Collections.sort(mainTRADE, new ListOfStatComparator()); |
|||
Collections.reverse(mainTRADE); |
|||
|
|||
for(int x = 0 ; x<mainTRADE.size();x++) { |
|||
if(x>200) { |
|||
mainTRADE.remove(x); |
|||
} |
|||
} |
|||
|
|||
//reset projection
|
|||
PROJ_analysis.calculate(); |
|||
team1.setInTrade(false); |
|||
team2.setInTrade(false); |
|||
|
|||
return mainTRADE; |
|||
} |
|||
|
|||
public static void recursiveOtherT(int boucleID, int playerStart , int nbt1PSelected, Teams team1, Teams team2, boolean inversed , boolean countNeg) { |
|||
|
|||
if (boucleID < nbt1PSelected) { |
|||
for (int x = playerStart; x < team2.players.size();x++) { |
|||
if(team2.players.get(x).getOrgTeamID() == team2.getID()) { |
|||
team2.players.get(x).setInTrade(true); |
|||
//team2.players.get(x).setteamID(team1.getCode());
|
|||
if (boucleID==nbt1PSelected-1) { |
|||
if(inversed) { |
|||
ArrayList<Stat> tst = Execute(team2,team1, countNeg); |
|||
if(tst != null) { |
|||
mainTRADE.add(tst); |
|||
} |
|||
}else { |
|||
ArrayList<Stat> tst = Execute(team1,team2, countNeg); |
|||
if(tst != null) { |
|||
mainTRADE.add(tst); |
|||
} |
|||
} |
|||
}else { |
|||
recursiveOtherT(boucleID+1,x+1,nbt1PSelected,team1,team2, inversed , countNeg); |
|||
} |
|||
//team2.players.get(x).setteamID(team2.getCode());
|
|||
team2.players.get(x).setInTrade(false); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
public static void recursiveTeam(int boucleID,int playerStart, int nbt1PSelected, Teams team1, Teams team2, boolean countNeg) { |
|||
if (boucleID < nbt1PSelected) { |
|||
for (int x = playerStart; x < team1.players.size();x++) { |
|||
if(team1.players.get(x).getOrgTeamID() == team1.getID()) { |
|||
team1.players.get(x).setInTrade(true); |
|||
//team1.players.get(x).setteamID(team2.getCode());
|
|||
if (boucleID==nbt1PSelected-1) { |
|||
recursiveOtherT(0,0,nbt1PSelected,team1,team2,false, countNeg); |
|||
}else { |
|||
recursiveTeam(boucleID+1,x+1,nbt1PSelected,team1,team2, countNeg); |
|||
} |
|||
//team1.players.get(x).setteamID(team1.getCode());
|
|||
team1.players.get(x).setInTrade(false); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
//----executre le calcul du trade en fonction des joueurs "inTrade" de chaque équipe----
|
|||
public static ArrayList<Stat> Execute(Teams team1,Teams team2,boolean countNeg){ |
|||
|
|||
String p1Trade=""; |
|||
String p2Trade=""; |
|||
final DecimalFormat f = new DecimalFormat("0.#"); |
|||
final DecimalFormat in = new DecimalFormat("0.##"); |
|||
|
|||
//change le team code des joueurs de la team 1
|
|||
for (Player playerT1 : team1.players) { |
|||
if (playerT1.inTrade && playerT1.getOrgTeamID() == team1.getID()){ // && playerT1.getteamID() == team1.getCode()
|
|||
playerT1.teamID = team2.getID(); |
|||
p1Trade += playerT1.getnom() + " / "; |
|||
} |
|||
} |
|||
|
|||
//change le team code des joueurs de la team 2
|
|||
for (Player playerT2 : team2.players) { |
|||
if (playerT2.inTrade && playerT2.getOrgTeamID() == team2.getID()){ // && playerT2.getteamID() == team2.getCode()
|
|||
playerT2.teamID = team1.getID(); |
|||
p2Trade += playerT2.getnom() + " / "; |
|||
} |
|||
} |
|||
|
|||
//-----------calcule la nouvelle projection
|
|||
PROJ_analysis.calculate(); |
|||
|
|||
// RK-P
|
|||
//enregistre l'impact sur chaque stats (ranking et valeur) + classement -------------------- P1
|
|||
ArrayList<Stat> subFA = new ArrayList<Stat>(); |
|||
Stat valGeneral = new Stat("RK-P"); |
|||
valGeneral.setPlayer(p1Trade); |
|||
//nom joueur droppé in team name of stat
|
|||
valGeneral.setTeam(p2Trade); |
|||
valGeneral.setProjectedRK(team1.getProjRK()); |
|||
valGeneral.setValProjection(f.format(team1.getProjTot())); |
|||
valGeneral.setValToRank(Float.parseFloat(valGeneral.getValProjection())); |
|||
subFA.add(valGeneral); |
|||
//----------------------------loop all stats
|
|||
//add projection results for each stat category
|
|||
for (int j = 0; j < l1.loopStatsTeam; j++) { |
|||
Stat valStats = new Stat(l1.loadStatBaseTeam.get(j).getName()); |
|||
valStats.setProjectedRK(team1.stats.get(j).getProjectedRK()); |
|||
valStats.setValProjection(team1.stats.get(j).getValProjection()); |
|||
subFA.add(valStats); |
|||
} |
|||
|
|||
//-----------------------CREATE IMPACT COLUMS-----------------------------------
|
|||
Stat valImpactR = new Stat("IMP"); // RK D
|
|||
valImpactR.setValProjection(f.format(team1.getProjRKX()-team1.getProjRK())); |
|||
subFA.add(valImpactR); |
|||
Stat valImpactP = new Stat("IMP"); //PT D
|
|||
valImpactP.setValProjection(f.format(team1.getProjTot()-team1.getProjTotX())); |
|||
subFA.add(valImpactP); |
|||
|
|||
Stat valImpactR12 = new Stat("IMP"); // TOT R
|
|||
valImpactR12.setValProjection(f.format(team1.getProjRKX()-team1.getProjRK() + team2.getProjRKX()-team2.getProjRK())); // valRot used to store totals diff
|
|||
subFA.add(valImpactR12); |
|||
|
|||
Stat valImpactP12 = new Stat("IMP"); //TOT P
|
|||
valImpactP12.setValProjection(f.format(team1.getProjTot()-team1.getProjTotX() + team2.getProjTot()-team2.getProjTotX())); // valRot used to store totals diff
|
|||
subFA.add(valImpactP12); |
|||
|
|||
Stat valImpactR2 = new Stat("IMP"); // RK D
|
|||
valImpactR2.setValProjection(f.format(team2.getProjRKX()-team2.getProjRK())); |
|||
subFA.add(valImpactR2); |
|||
|
|||
Stat valImpactP2 = new Stat("IMP"); // PT D
|
|||
valImpactP2.setValProjection(f.format(team2.getProjTot()-team2.getProjTotX())); |
|||
subFA.add(valImpactP2); |
|||
|
|||
//enregistre l'impact sur chaque stats (ranking et valeur) + classement --------------------- P2
|
|||
valGeneral = new Stat("RK-P"); |
|||
valGeneral.setPlayer(p2Trade); |
|||
//nom joueur droppé in team name of stat
|
|||
valGeneral.setTeam(p1Trade); |
|||
valGeneral.setProjectedRK(team2.getProjRK()); |
|||
valGeneral.setValProjection(f.format(team2.getProjTot())); |
|||
valGeneral.setValToRank(Float.parseFloat(valGeneral.getValProjection())); |
|||
subFA.add(valGeneral); |
|||
|
|||
//----------------------------loop all stats
|
|||
//add projection results for each stat category
|
|||
for (int j = 1; j < l1.loopStatsTeam+1; j++) { |
|||
Stat valStats = new Stat(l1.loadStatBaseTeam.get(j - 1).getName()); |
|||
valStats.setProjectedRK(team2.stats.get(j - 1).getProjectedRK()); |
|||
valStats.setValProjection(team2.stats.get(j - 1).getValProjection()); |
|||
subFA.add(valStats); |
|||
} |
|||
//--------------------------------------------------------------------------loop all other teams
|
|||
//add impact on other players ranking
|
|||
for (Teams teamX : l1.leagueTeams) { |
|||
if (!teamX.getName().equals(team1.getName()) && !teamX.getName().equals(team2.getName())) { |
|||
Stat impacts = new Stat(teamX.getSurn()); |
|||
impacts.setProjectedRK(teamX.getProjRK()); |
|||
impacts.setValProjection(f.format(teamX.getProjTot())); |
|||
subFA.add(impacts); |
|||
} |
|||
} |
|||
|
|||
//redefini le bon id de team
|
|||
for (int i = 0;i<team1.players.size();i++) { |
|||
Player p = team1.players.get(i); |
|||
if (p.inTrade && p.getOrgTeamID() == team1.getID()){ // && p.getteamID() != team1.getCode()
|
|||
p.teamID = team1.getID(); |
|||
//p.setInTrade(false);
|
|||
} |
|||
} |
|||
for (int i = 0;i<team2.players.size();i++) { |
|||
Player p = team2.players.get(i); |
|||
if (p.inTrade && p.getOrgTeamID() == team2.getID()){ // && p.getteamID() != team2.getCode()
|
|||
p.teamID = team2.getID(); |
|||
//p.setInTrade(false);
|
|||
} |
|||
} |
|||
|
|||
//------------------------EXIT IF RESULT NOT RELEVANT----------------------------------------<
|
|||
if(((team1.getProjTot() < team1.getProjTotX()) || (team2.getProjTot() < team2.getProjTotX())) && !countNeg) { |
|||
return null; |
|||
} |
|||
|
|||
return subFA; |
|||
|
|||
} |
|||
|
|||
static final class ListOfStatComparator implements Comparator < ArrayList < Stat >> { |
|||
|
|||
@Override |
|||
public int compare(ArrayList < Stat > o1, ArrayList < Stat > o2) { |
|||
// do other error checks here as well... such as null. outofbounds, etc
|
|||
return new Float(o1.get(sortKey).getValProjection()).compareTo(new Float(o2.get(sortKey).getValProjection())); |
|||
} |
|||
|
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,280 @@ |
|||
package jsoupImport; |
|||
|
|||
import java.util.concurrent.Future; |
|||
|
|||
import javax.servlet.RequestDispatcher; |
|||
|
|||
import org.jsoup.Jsoup; |
|||
import org.jsoup.nodes.Document; |
|||
import org.jsoup.nodes.Element; |
|||
import org.jsoup.select.Elements; |
|||
import org.openqa.selenium.By; |
|||
import org.openqa.selenium.support.ui.ExpectedConditions; |
|||
|
|||
import call_pages.CALL_Fantasy; |
|||
import functions.GRAPH_rebuild; |
|||
import functions.MySQLAccess; |
|||
import functions.PROJ_analysis; |
|||
import objects.League; |
|||
import objects.Player; |
|||
import objects.Slot; |
|||
import objects.Stat; |
|||
import objects.Teams; |
|||
|
|||
import java.io.ByteArrayOutputStream; |
|||
import java.io.IOException; |
|||
import java.io.InputStream; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** * Created by LeJay on 19.02.2017. */ |
|||
|
|||
public class ImportLineups extends CALL_Fantasy { |
|||
|
|||
public ImportLineups() { |
|||
|
|||
//new Thread(new Runnable() {
|
|||
// public void run() {
|
|||
|
|||
Document doc; |
|||
|
|||
try { |
|||
|
|||
driver.get("http://fantasy.espn.com/basketball/team?leagueId=" + l1.getCode() + |
|||
"&teamId=" + l1.leagueTeams.get(1).getID());// + "&seasonId=" + l1.getSeason() +
|
|||
//"&scoringPeriodId=" + l1.getNbDaysPlayed() + "&statSplit=singleScoringPeriodn");
|
|||
|
|||
|
|||
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@class='jsx-2810852873 table--cell opp ml4']")));// instead of id u can use cssSelector or xpat
|
|||
String content = driver.getPageSource(); |
|||
|
|||
doc = Jsoup.parse(content); |
|||
|
|||
//select player name table
|
|||
Element tablePlayer = doc.select("table.Table2__right-aligned.Table2__table-fixed.Table2__Table--fixed--left.Table2__table").get(0); //select the first table.
|
|||
Elements rowsPlayer = tablePlayer.select("tr"); |
|||
Element rowPlayer; |
|||
Elements colsPlayer; |
|||
|
|||
//select stat table
|
|||
Element tableStat = doc.select("table.Table2__table-scroller.Table2__right-aligned.Table2__table").get(0); //select the first table.
|
|||
Elements rowsStat = tableStat.select("tr"); |
|||
Element rowStat; |
|||
Elements colsStat; |
|||
|
|||
|
|||
|
|||
rowStat = rowsStat.select("tr.Table2__header-row.Table2__tr.Table2__even").get(1); |
|||
colsStat = rowStat.select("th"); |
|||
//----------create stats list from first line 0
|
|||
int nbStat = 0; |
|||
Stat[] loadStatBase = new Stat[colsStat.size()]; |
|||
for (int k = 1; k < colsStat.size()-3; k++) { // 6 is col FGM
|
|||
|
|||
if (!colsStat.get(k).text().replaceAll("\\s","").equals("")){ |
|||
loadStatBase[nbStat] = new Stat(colsStat.get(k).text().replaceAll("\\s", "")); |
|||
nbStat += 1; |
|||
} |
|||
String test = colsStat.get(k).text().replaceAll("\\s",""); |
|||
if(colsStat.get(k).text().replaceAll("\\s","").equals("+/-")){ |
|||
break ; |
|||
}; |
|||
} |
|||
|
|||
for (int t = 0; t < l1.nbTeams; t++) { |
|||
|
|||
|
|||
|
|||
for (int periode = 0 ; periode < l1.getNbDaysPlayed(); periode++) { |
|||
|
|||
//test si record n'existe pas déjà dans la DB pour cette equipe et ce jour
|
|||
int test5 = dao.dayRecorded(l1.leagueTeams.get(t),periode); |
|||
int test6 = dao.dayRecorded(l1.leagueTeams.get(t),periode+1); |
|||
int test7 = dao.dayRecorded(l1.leagueTeams.get(t),periode+2); |
|||
int test8 = dao.dayRecorded(l1.leagueTeams.get(t),periode+7); |
|||
|
|||
//si le nombre de record est bien un multiple du nombre de stats
|
|||
if( (((test5==0) && (test6==0) && (test7==0) && (test8==0)) || test5%nbStat > 0) ) {//need to skip empty days
|
|||
|
|||
//efface les records présent s'il n'était pas complet
|
|||
if(test5%nbStat > 0 )dao.delStat(l1.leagueTeams.get(t),periode); |
|||
|
|||
int periodeF = periode+1; |
|||
|
|||
driver.get("http://fantasy.espn.com/basketball/team?leagueId=" + l1.getCode() + |
|||
"&teamId=" + l1.leagueTeams.get(t).getID() + "&statSplit=singleScoringPeriod&scoringPeriodId=" + periodeF); |
|||
|
|||
|
|||
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@class='jsx-2810852873 table--cell opp ml4']")));// instead of id u can use cssSelector or xpat
|
|||
|
|||
content = driver.getPageSource(); |
|||
|
|||
doc = Jsoup.parse(content); |
|||
|
|||
//select player name table
|
|||
tablePlayer = doc.select("table.Table2__right-aligned.Table2__table-fixed.Table2__Table--fixed--left.Table2__table").get(0); //select the first table.
|
|||
rowsPlayer = tablePlayer.select("tr"); |
|||
|
|||
|
|||
|
|||
//select stat table
|
|||
tableStat = doc.select("table.Table2__table-scroller.Table2__right-aligned.Table2__table").get(0); //select the first table.
|
|||
rowsStat = tableStat.select("tr"); |
|||
|
|||
|
|||
|
|||
int nbSlot = 0; |
|||
// go through SLOT list------------Slot LOOP--------
|
|||
for (int i = 2; i < rowsPlayer.size(); i++) { //first rows
|
|||
|
|||
rowPlayer = rowsPlayer.get(i); |
|||
colsPlayer = rowPlayer.select("td"); |
|||
|
|||
rowStat = rowsStat.get(i); |
|||
colsStat = rowStat.select("td"); |
|||
|
|||
if (!colsPlayer.get(0).text().equals("SLOT") && !colsPlayer.get(0).text().equals("Bench") && //take out bench for
|
|||
colsPlayer.get(1).text().length() > 6 && !colsStat.get(6).text().equals("--") && !colsStat.get(0).text().equals("0")) { |
|||
|
|||
|
|||
String word = colsPlayer.select("a.link.clr-link.pointer").get(0).text().replace("*", ""); |
|||
|
|||
//create player
|
|||
|
|||
l1.leagueTeams.get(t).slots[nbSlot].players[periode] = new Player(word); |
|||
l1.leagueTeams.get(t).slots[nbSlot].players[periode].setteamID(l1.leagueTeams.get(t).getID()); |
|||
|
|||
|
|||
//--------------Add DAILY Stats to player
|
|||
|
|||
//-----------------------------------------------Create a copy of Stat list
|
|||
ArrayList<Stat> loadStat = new ArrayList<Stat>(); |
|||
|
|||
nbStat = 0; |
|||
for (int k = 1; k < colsStat.size() - 3; k++) { //first row is the col names so skip it.
|
|||
|
|||
//System.out.println(cols.get(k).text());
|
|||
|
|||
if (!colsStat.get(k).text().replaceAll("\\s", "").equals("")) { |
|||
loadStat.add(new Stat(loadStatBase[nbStat].getName())); |
|||
loadStat.get(nbStat).setStatVal(colsStat.get(k).text()); |
|||
loadStat.get(nbStat).setSlot(colsPlayer.get(0).text()); |
|||
loadStat.get(nbStat).setPeriod(periode); |
|||
loadStat.get(nbStat).setSlotID(i-2); |
|||
//enregistre le stat dans la database
|
|||
dao.addStat(loadStat.get(nbStat), l1.leagueTeams.get(t).slots[nbSlot].players[periode], l1.leagueTeams.get(t).getID()); |
|||
//System.out.println(loadStatBase[nbStat].getName() + " ----- " +colsStat.get(k).text());
|
|||
nbStat += 1; |
|||
} |
|||
|
|||
if(nbStat > l1.loadStatBasePlayer.size()){break;}; |
|||
} |
|||
|
|||
//ajoute les stats au joueur ajouté au slot
|
|||
l1.leagueTeams.get(t).slots[nbSlot].players[periode].setStats(loadStat); |
|||
|
|||
String log = periode + "--->" + colsPlayer.get(1).text(); |
|||
for (int k = 1; k < colsStat.size()-3; k++) { |
|||
log += "/" + colsStat.get(k).text(); |
|||
} |
|||
System.out.println(log); |
|||
} |
|||
|
|||
nbSlot += 1; |
|||
|
|||
} |
|||
|
|||
}else{ |
|||
// --------------------LOAD DATA from DB
|
|||
List<Stat> records = dao.getStatList(l1.leagueTeams.get(t),periode); |
|||
|
|||
// go through record list------------record LOOP--------
|
|||
for (int i = 0; i < records.size(); i+=nbStat) { //first rows
|
|||
|
|||
//----Get Record list from the DB ------ recréer et affecte un stat
|
|||
ArrayList<Stat> loadStats = new ArrayList<Stat>(); //set stat name
|
|||
for (int s = 0; s < nbStat; s++) { |
|||
loadStats.add(records.get(i+s)); |
|||
} |
|||
|
|||
int slotID = records.get(i).getSlotID(); |
|||
|
|||
try { |
|||
|
|||
//add player in period list & attach stats
|
|||
l1.leagueTeams.get(t).slots[slotID].players[periode] = new Player(records.get(i).getPlayer()); //set Nom
|
|||
l1.leagueTeams.get(t).slots[slotID].setNomPos(records.get(i).getSlot()); |
|||
l1.leagueTeams.get(t).slots[slotID].setSlotID(slotID); |
|||
l1.leagueTeams.get(t).slots[slotID].players[periode].setStats(loadStats); |
|||
|
|||
} catch (Exception e) { |
|||
// TODO Auto-generated catch block
|
|||
e.printStackTrace(); |
|||
|
|||
} |
|||
|
|||
} |
|||
System.out.println("loaded stat" ); |
|||
if(l1.leagueTeams.get(t).getName().equals("La Tour LeJay")){ |
|||
int odi = 1; |
|||
odi+=1; |
|||
}; |
|||
|
|||
} |
|||
|
|||
}//end loop periode
|
|||
}//end loop team
|
|||
|
|||
|
|||
for (int t = 0; t < l1.nbTeams; t++) { |
|||
// fill TOTAL ATTEMPT / MADE for FG & FT --------- need to come from importLineUps
|
|||
//loop team stats fill only composed stats
|
|||
for (Stat statTeamX : l1.leagueTeams.get(t).stats) { |
|||
if (statTeamX != null) |
|||
if (statTeamX.getName().contains("/")) { |
|||
float totStat1 = 0; |
|||
float totStat2 = 0; |
|||
//loop slots
|
|||
for (Slot slotX : l1.leagueTeams.get(t).slots) { |
|||
if (slotX != null) |
|||
//Do not count players aligned on the bench
|
|||
if (!slotX.getNomPos().contains("Bench") && slotX.players != null) //&& slotX.players != null
|
|||
//loop slot players
|
|||
|
|||
for (Player playerX : slotX.players) |
|||
if (playerX != null) { |
|||
//loop stats
|
|||
for (Stat statX : playerX.stats) |
|||
//focus on actual team stat to fill (loop1)
|
|||
if (statX.getName().equals(statTeamX.getName())) { |
|||
String[] decomp = statX.getStatVal().split("/"); |
|||
float valStat1 = Float.parseFloat(decomp[0]); |
|||
float valStat2 = Float.parseFloat(decomp[1]); |
|||
totStat1 += valStat1; |
|||
totStat2 += valStat2; |
|||
} |
|||
} |
|||
}//for slots
|
|||
String valStatSeason = totStat1 + "/" + totStat2; |
|||
statTeamX.setValSeason(valStatSeason); |
|||
}//if stat /
|
|||
}//for team stat
|
|||
}//for team
|
|||
|
|||
|
|||
//new PROJ_analysis().calculate();
|
|||
|
|||
|
|||
|
|||
} catch (IOException e) { |
|||
e.printStackTrace(); |
|||
} catch (Exception e) { |
|||
// TODO Auto-generated catch block
|
|||
e.printStackTrace(); |
|||
} |
|||
|
|||
// }
|
|||
//}).start();
|
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,161 @@ |
|||
package jsoupImport; |
|||
|
|||
|
|||
|
|||
|
|||
import org.jsoup.Jsoup; |
|||
import org.jsoup.nodes.Document; |
|||
import org.jsoup.nodes.Element; |
|||
import org.jsoup.select.Elements; |
|||
import org.openqa.selenium.By; |
|||
import org.openqa.selenium.support.ui.ExpectedConditions; |
|||
|
|||
import call_pages.CALL_Fantasy; |
|||
import objects.League; |
|||
import objects.Player; |
|||
import objects.Stat; |
|||
import objects.Teams; |
|||
|
|||
import java.io.ByteArrayOutputStream; |
|||
import java.io.IOException; |
|||
import java.io.InputStream; |
|||
import java.util.ArrayList; |
|||
|
|||
/** |
|||
* Created by LeJay on 19.02.2017. |
|||
*/ |
|||
|
|||
public class ImportPlayerStats extends CALL_Fantasy { //called from btn of selected team in Fragment team
|
|||
|
|||
public ImportPlayerStats() throws IOException { |
|||
|
|||
if(l1.leaguePlayers.size() <= l1.leagueTeams.size()*15) { |
|||
|
|||
ArrayList<Player> players = new ArrayList<Player>(); |
|||
|
|||
String title; |
|||
Document doc; |
|||
int nbStat; |
|||
|
|||
driver.get("http://fantasy.espn.com/basketball/players/add?leagueId=" + l1.getCode() ); |
|||
|
|||
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//tr[@class='Table2__tr Table2__tr--lg Table2__odd']")));// instead of id u can use cssSelector or xpath of ur element.
|
|||
String content = driver.getPageSource(); |
|||
|
|||
//-----create stats list from first line 0
|
|||
doc = Jsoup.parse(content); |
|||
|
|||
// add all player com.example.lejay.fantasy.objects
|
|||
int nbPlayer = 0; |
|||
//for (int z = 0; z < 400; z+=50) {
|
|||
|
|||
//http://fantasy.espn.com/basketball/league/standings?leagueId=209346
|
|||
//http://fantasy.espn.com/basketball/players/add?leagueId=209346
|
|||
|
|||
//tst = "http://fantasy.espn.com/basketball/players/add?leagueId=" + l1.getCode() +
|
|||
// "&seasonId="+ l1.getSeason() +"&context=freeagency&view=stats&version=currSeason&startIndex=" + z;
|
|||
|
|||
//doc = Jsoup.connect("http://games.espn.com/fba/freeagency?leagueId=" + l1.getCode() +
|
|||
// "&seasonId="+ l1.getSeason() +"&context=freeagency&view=stats&version=currSeason&startIndex=" + z).get();
|
|||
|
|||
//select player name table
|
|||
Element tablePlayer = doc.select("table.Table2__right-aligned.Table2__table-fixed.Table2__Table--fixed--left.Table2__table").get(0); //select the first table.
|
|||
Elements rowsPlayer = tablePlayer.select("tr"); |
|||
Element rowPlayer; |
|||
Elements colsPlayer; |
|||
|
|||
//select stat table
|
|||
Element tableStat = doc.select("table.Table2__table-scroller.Table2__right-aligned.Table2__table").get(0); //select the first table.
|
|||
Elements rowsStat = tableStat.select("tr"); |
|||
Element rowStat; |
|||
Elements colsStat; |
|||
|
|||
if (l1.loadStatBasePlayer.size()==0){ |
|||
//'-------------create and fill Stats name'
|
|||
|
|||
rowStat = doc.select("tr.Table2__header-row.Table2__tr.Table2__even").get(3); |
|||
colsStat = rowStat.select("th"); |
|||
for (int k = 1; k < colsStat.size()-1; k++) { |
|||
l1.loadStatBasePlayer.add(new Stat(colsStat.get(k).text())); |
|||
} |
|||
l1.setNbStatsPlayer(l1.loadStatBasePlayer.size()); |
|||
} |
|||
|
|||
// get page title
|
|||
title = doc.title(); |
|||
System.out.println("title : " + title); |
|||
|
|||
// go through players list
|
|||
for (int i = 2; i < rowsPlayer.size(); i++) { //first row is the col names so skip it.
|
|||
|
|||
rowPlayer = rowsPlayer.get(i); |
|||
colsPlayer = rowPlayer.select("td"); |
|||
|
|||
rowStat = rowsStat.get(i); |
|||
colsStat = rowStat.select("td"); |
|||
|
|||
String log = ""; |
|||
|
|||
|
|||
// le nom
|
|||
String word = colsPlayer.select("a.link.clr-link.pointer").get(0).text(); |
|||
String nomFranchise = colsPlayer.select("span.playerinfo__playerteam").get(0).text(); |
|||
String[] positions = colsPlayer.select("span.playerinfo__playerpos.ttu").get(0).text().split(", "); |
|||
|
|||
//create player
|
|||
l1.leaguePlayers.add(new Player(word)); |
|||
nbPlayer = l1.leaguePlayers.size()-1; |
|||
|
|||
l1.leaguePlayers.get(nbPlayer).setPositions(positions); |
|||
l1.leaguePlayers.get(nbPlayer).setFranchise(nomFranchise); |
|||
|
|||
|
|||
/*if(cols.get(2).text().substring(0,2).equals("WA")){ |
|||
l1.leaguePlayers.get(nbPlayer).setIsFA(true); |
|||
l1.leaguePlayers.get(nbPlayer).isToCount = true; |
|||
} |
|||
else{players.get(nbPlayer).setIsFA(false);}*/ |
|||
|
|||
|
|||
//-----------------------------------------------Create a copy of Stat list
|
|||
ArrayList<Stat> loadStat = new ArrayList<Stat>(); |
|||
|
|||
nbStat = 0; |
|||
for (int k = 1; k < colsStat.size()-3; k++) { //first row is the col names so skip it.
|
|||
if (!colsStat.get(k).text().replaceAll("\\s","").equals("")) { |
|||
loadStat.add(new Stat(l1.loadStatBasePlayer.get(nbStat).getName())); |
|||
loadStat.get(nbStat).setStatVal(colsStat.get(k).text()); |
|||
nbStat += 1; |
|||
} |
|||
if(nbStat > l1.loadStatBasePlayer.size()){break;}; |
|||
} |
|||
|
|||
//ajoute les stats au joueur apres l avoir créé
|
|||
l1.leaguePlayers.get(nbPlayer).setStats(loadStat); |
|||
|
|||
nbPlayer+=1; |
|||
|
|||
for (int k = 0; k < colsStat.size(); k++) { |
|||
log += "/" + colsStat.get(k).text(); |
|||
} |
|||
System.out.println(log); |
|||
} |
|||
|
|||
System.out.println("yo"); |
|||
|
|||
|
|||
} |
|||
/* @Override |
|||
protected void onPostExecute(Void result) { |
|||
// Set title into TextView
|
|||
//TextView txttitle = (TextView) findViewById(R.id.titletxt);
|
|||
//txttitle.setText(title);
|
|||
|
|||
FragmentPlayers.btn_tstFA.setEnabled(true); |
|||
|
|||
// mProgressDialog.dismiss();
|
|||
}*/ |
|||
|
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,161 @@ |
|||
package jsoupImport; |
|||
|
|||
import functions.*; |
|||
import objects.Player; |
|||
import objects.Stat; |
|||
|
|||
import org.jsoup.Jsoup; |
|||
import org.jsoup.nodes.Document; |
|||
import org.jsoup.nodes.Element; |
|||
import org.jsoup.select.Elements; |
|||
import org.openqa.selenium.By; |
|||
import org.openqa.selenium.support.ui.ExpectedConditions; |
|||
|
|||
import call_pages.CALL_Fantasy; |
|||
|
|||
import java.io.IOException; |
|||
import java.util.ArrayList; |
|||
|
|||
/** |
|||
* Created by LeJay on 19.02.2017. |
|||
*/ |
|||
|
|||
public class ImportPlayers extends CALL_Fantasy {//called from MainActivity
|
|||
|
|||
public ImportPlayers() { |
|||
|
|||
//new Thread(new Runnable() {
|
|||
// public void run() {
|
|||
|
|||
String title; |
|||
int nbStat; |
|||
|
|||
//dbHandler = new DB_handler(context); //need to be in async
|
|||
|
|||
Document doc; |
|||
for (int t = 0; t < l1.nbTeams; t++) { |
|||
|
|||
//create list of player
|
|||
l1.leagueTeams.get(t).players = new ArrayList<Player>(); |
|||
|
|||
driver.get("http://fantasy.espn.com/basketball/team?leagueId=" + l1.getCode() + |
|||
"&teamId=" + l1.leagueTeams.get(t).getID() + "&statSplit=currSeason");// + "&seasonId=" + l1.getSeason() +
|
|||
//"&scoringPeriodId=" + l1.getNbDaysPlayed() + "&statSplit=singleScoringPeriodn");
|
|||
|
|||
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@class='jsx-2810852873 table--cell opp ml4']")));// instead of id u can use cssSelector or xpat
|
|||
String content = driver.getPageSource(); |
|||
|
|||
doc = Jsoup.parse(content); |
|||
|
|||
// get page title
|
|||
title = doc.title(); |
|||
System.out.println("title : " + title); |
|||
|
|||
//select player name table
|
|||
Element tablePlayer = doc.select("table.Table2__right-aligned.Table2__table-fixed.Table2__Table--fixed--left.Table2__table").get(0); //select the first table.
|
|||
Elements rowsPlayer = tablePlayer.select("tr"); |
|||
Element rowPlayer; |
|||
Elements colsPlayer; |
|||
|
|||
//select stat table
|
|||
Element tableStat = doc.select("table.Table2__table-scroller.Table2__right-aligned.Table2__table").get(0); //select the first table.
|
|||
Elements rowsStat = tableStat.select("tr"); |
|||
Element rowStat; |
|||
Elements colsStat; |
|||
|
|||
int nbPlayer = 0; |
|||
// go through players list
|
|||
for (int i = 2; i < rowsPlayer.size(); i++) { //first row is the col names so skip it.
|
|||
|
|||
rowPlayer = rowsPlayer.get(i); |
|||
colsPlayer = rowPlayer.select("td"); |
|||
|
|||
rowStat = rowsStat.get(i); |
|||
colsStat = rowStat.select("td"); |
|||
|
|||
String log = ""; |
|||
|
|||
// System.out.println(cols.get(0).text());
|
|||
// for (int k = 0; k < cols.size(); k++) {
|
|||
// log += "/" + cols.get(k).text();
|
|||
// }
|
|||
// System.out.println(log);
|
|||
|
|||
if (!colsPlayer.get(1).text().equals("Empty") && !colsPlayer.get(1).text().equals("")) { |
|||
|
|||
|
|||
// le nom
|
|||
String word = colsPlayer.select("a.link.clr-link.pointer").get(0).text(); |
|||
String nomFranchise = colsPlayer.select("span.playerinfo__playerteam").get(0).text(); |
|||
String[] positions = colsPlayer.select("span.playerinfo__playerpos.ttu").get(0).text().split(", "); |
|||
|
|||
l1.leagueTeams.get(t).players.add(new Player(word)); |
|||
|
|||
int tt = l1.leagueTeams.get(t).players.size(); |
|||
Player player = l1.leagueTeams.get(t).players.get(tt-1); |
|||
player.setPositions(positions); |
|||
player.setFranchise(nomFranchise); |
|||
|
|||
//-----------------------------------------------Create a copy of Stat list
|
|||
ArrayList<Stat> loadStat = new ArrayList<Stat>(); |
|||
nbStat = 0; |
|||
int nbSpace=0; |
|||
for (int k = 1; k < colsStat.size()-1; k++) { //first row is the col names so skip it.
|
|||
System.out.println(colsStat.get(k).text()); |
|||
if (!colsStat.get(k).text().replaceAll("\\s","").equals("")) { |
|||
loadStat.add(new Stat(l1.loadStatBasePlayer.get(nbStat-nbSpace).getName())); |
|||
loadStat.get(nbStat-nbSpace).setStatVal(colsStat.get(k-nbSpace).text()); |
|||
}else{ |
|||
nbSpace++; |
|||
} |
|||
nbStat += 1; |
|||
|
|||
if(nbStat > l1.loadStatBasePlayer.size()){break;}; |
|||
} |
|||
//ajoute les stats au joueur apres l avoir créé
|
|||
player.setStats(loadStat); |
|||
player.setIsFA(false); |
|||
player.teamID = l1.leagueTeams.get(t).getID(); |
|||
player.setOrgTeamID(l1.leagueTeams.get(t).getID()); |
|||
|
|||
l1.leaguePlayers.add(player); |
|||
|
|||
nbPlayer += 1; |
|||
|
|||
} |
|||
|
|||
} |
|||
|
|||
System.out.println("yo"); |
|||
|
|||
RANKS_fill.fillPlayerRKinTeamOWN(l1.leagueTeams.get(t)); |
|||
|
|||
}//end loop team
|
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
/*@Override |
|||
protected void onPostExecute(Void result) { |
|||
|
|||
SHOW_tab.printTeams(); |
|||
|
|||
//projection need actual total attempt / made just calculated
|
|||
btn_Proj.setEnabled(true); |
|||
|
|||
// Fragment f = getFragmentManager().findFragmentById(R.id.frag_teams);
|
|||
// if(f != null){
|
|||
// for(Teams teams : l1.leagueTeams){
|
|||
// FragmentTeams.btn_teams[teams.getCode()].setEnabled(true);
|
|||
// }
|
|||
// }
|
|||
|
|||
PROJ_analysis.calculate(); |
|||
|
|||
//mProgressDialog.dismiss();
|
|||
}*/ |
|||
// }).start();
|
|||
//}
|
|||
} |
|||
@ -0,0 +1,429 @@ |
|||
package jsoupImport; |
|||
|
|||
import org.jsoup.Jsoup; |
|||
import org.jsoup.nodes.Document; |
|||
import org.jsoup.nodes.Element; |
|||
import org.jsoup.select.Elements; |
|||
import org.openqa.selenium.By; |
|||
import org.openqa.selenium.WebDriver; |
|||
import org.openqa.selenium.firefox.FirefoxDriver; |
|||
import org.openqa.selenium.remote.DesiredCapabilities; |
|||
import org.openqa.selenium.WebElement; |
|||
|
|||
import org.openqa.selenium.support.ui.ExpectedCondition; |
|||
import org.openqa.selenium.support.ui.ExpectedConditions; |
|||
import org.openqa.selenium.support.ui.WebDriverWait; |
|||
|
|||
import com.ibm.icu.text.SimpleDateFormat; |
|||
|
|||
import call_content.GRAPH_CALL; |
|||
import call_pages.CALL_Fantasy; |
|||
|
|||
import java.io.IOException; |
|||
import java.net.URL; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
import java.util.concurrent.TimeUnit; |
|||
import java.util.regex.Pattern; |
|||
|
|||
import javax.servlet.http.HttpServletResponse; |
|||
import javax.swing.JOptionPane; |
|||
|
|||
import functions.GRAPH_init; |
|||
import functions.GRAPH_rebuild; |
|||
import functions.MySQLAccess; |
|||
import functions.RANKS_fill; |
|||
import io.webfolder.ui4j.api.browser.BrowserEngine; |
|||
import io.webfolder.ui4j.api.browser.BrowserFactory; |
|||
import io.webfolder.ui4j.api.browser.Page; |
|||
import objects.League; |
|||
import objects.Slot; |
|||
import objects.Stat; |
|||
import objects.Teams; |
|||
|
|||
public class ImportTeams extends CALL_Fantasy { |
|||
|
|||
|
|||
public ImportTeams() throws Exception { |
|||
|
|||
|
|||
driver.get("http://fantasy.espn.com/basketball/league/standings?leagueId=" + l1.getCode()); |
|||
|
|||
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("disneyid-iframe")));// instead of id u can use cssSelector or xpath of ur element.
|
|||
driver.switchTo().frame(driver.findElement(By.id("disneyid-iframe"))); |
|||
|
|||
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//input[@type='email']")));// instead of id u can use cssSelector or xpath of ur element.
|
|||
WebElement element = driver.findElement(By.xpath("//input[@type='email']")); |
|||
element.sendKeys("[email protected]"); |
|||
|
|||
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//input[@type='password']")));// instead of id u can use cssSelector or xpath of ur element.
|
|||
element = driver.findElement(By.xpath("//input[@type='password']")); |
|||
element.sendKeys("1800vevey"); |
|||
|
|||
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//button[@class='btn btn-primary btn-submit ng-isolate-scope']")));// instead of id u can use cssSelector or xpath of ur element.
|
|||
element = driver.findElement(By.cssSelector("button[class='btn btn-primary btn-submit ng-isolate-scope']")); |
|||
element.click(); |
|||
|
|||
driver.switchTo().defaultContent(); |
|||
|
|||
wait.until(ExpectedConditions.elementToBeClickable(By.className("dropdown__select")));// instead of id u can use cssSelector or xpath of ur element.
|
|||
String content = driver.getPageSource(); |
|||
|
|||
Elements colsStatName; |
|||
Document doc; |
|||
String title; |
|||
ArrayList<Teams> leagueTeams = new ArrayList<Teams>(); |
|||
try { |
|||
|
|||
// connect to STANDINGS
|
|||
//doc = Jsoup.connect("http://fantasy.espn.com/basketball/league/standings?leagueId=" + l1.getCode()).get();
|
|||
|
|||
|
|||
|
|||
|
|||
doc = Jsoup.parse(content); |
|||
String leagueName = doc.select("h3").get(0).text().replace("Standings", ""); |
|||
|
|||
l1.setName(leagueName); |
|||
|
|||
|
|||
//----------------------GET TEAMS ID------------------
|
|||
Elements links = doc.select("a[class]"); |
|||
|
|||
int nbTeam = 0; |
|||
String nomTeam = ""; |
|||
String nomJoueur =""; |
|||
String surn = ""; |
|||
for (Element link : links) { |
|||
|
|||
if (link.attr("class").contains("NavMain__SubNav__Link") && link.attr("href").contains("fromTeamId=")) { |
|||
|
|||
String test = link.select("span.sub").text(); |
|||
|
|||
if(test.equals(l1.getName())) { |
|||
String find[] = link.attr("href").split("fromTeamId="); |
|||
int teamID = Integer.parseInt(find[1]); |
|||
nomTeam = link.select("span.NavMain__Text").text().replace(" " + l1.getName(), ""); |
|||
|
|||
leagueTeams.add(new Teams(nomTeam, nbTeam)); |
|||
leagueTeams.get(nbTeam).setNomJoueur(nomTeam); |
|||
leagueTeams.get(nbTeam).setID(teamID); |
|||
|
|||
nbTeam += 1; |
|||
} |
|||
|
|||
|
|||
}else if (link.attr("class").contains("NavMain__SubNav__Link") && link.attr("href").contains("teamId=") && !link.attr("href").contains("fromTeamId=")) { |
|||
|
|||
String find[] = link.attr("href").split("teamId="); |
|||
int teamID = Integer.parseInt(find[1]); |
|||
|
|||
nomTeam = link.select("span.NavMain__Text").text(); |
|||
String find2[] = nomTeam.split(Pattern.quote("(")); |
|||
String find3[] = find2[1].split(Pattern.quote(")")); |
|||
surn = find3[0]; |
|||
nomTeam = find2[0].substring(0, find2[0].length() -1); |
|||
|
|||
nomJoueur = link.select("span.owner-name").text(); |
|||
|
|||
leagueTeams.add(new Teams(nomTeam, nbTeam)); |
|||
leagueTeams.get(nbTeam).setNomJoueur(nomJoueur); |
|||
leagueTeams.get(nbTeam).setID(teamID); |
|||
leagueTeams.get(nbTeam).setSurn(surn); |
|||
|
|||
//
|
|||
|
|||
nbTeam += 1; |
|||
|
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
// -----------------SCAN league and add teams stats--------->
|
|||
title = doc.title(); |
|||
System.out.println("title : " + title); |
|||
|
|||
Element table = doc.select("table").get(2); //select the first table.
|
|||
System.out.println("table : " + table); |
|||
Elements rows = table.select("tr"); |
|||
Element row = rows.get(0); |
|||
Elements cols = row.select("td"); |
|||
|
|||
|
|||
|
|||
//'-------------create and fill Stats name'
|
|||
Element startRow = rows.get(2); |
|||
colsStatName = startRow.select("span"); |
|||
|
|||
row = rows.get(2); |
|||
cols = row.select("span"); |
|||
int nbPourcent =0; |
|||
for (int k = 0; k < cols.size() + nbPourcent; k++) { |
|||
l1.loadStatBaseTeam.add(new Stat(cols.get(k-nbPourcent).text())); |
|||
if(cols.get(k-nbPourcent).text().contains("%")){ |
|||
nbPourcent +=1; |
|||
k+=1; |
|||
String nomStat = cols.get(k-nbPourcent).text().replace("%",""); |
|||
l1.loadStatBaseTeam.add(new Stat(nomStat + "M/"+ nomStat+"A")); |
|||
} |
|||
l1.setLoopStatsTeam(k); |
|||
} |
|||
l1.setNbStatsTeam(l1.loopStatsTeam-nbPourcent); |
|||
|
|||
|
|||
table = doc.select("table").get(1); //select the first table.
|
|||
rows = table.select("tr"); |
|||
|
|||
|
|||
// --------------------go through charts rows
|
|||
for (int i = 2; i <= rows.size()-2 ; i++) { //first row is the col names so skip it.
|
|||
|
|||
// go through team table
|
|||
table = doc.select("table").get(1); //select the first table.
|
|||
rows = table.select("tr"); |
|||
row = rows.get(i); |
|||
cols = row.select("td"); |
|||
|
|||
System.out.println("team : " + cols.get(1)); |
|||
|
|||
nomTeam = cols.get(1).text(); |
|||
|
|||
for(Teams team : leagueTeams) { |
|||
if (team.getName().equals(nomTeam)) { |
|||
nbTeam = team.getCode(); |
|||
break; |
|||
} |
|||
} |
|||
|
|||
leagueTeams.get(nbTeam).setRK(Double.parseDouble(cols.get(0).text())); |
|||
|
|||
// go through stats table
|
|||
table = doc.select("table").get(2); //select the first table.
|
|||
rows = table.select("tr"); |
|||
row = rows.get(i+1); |
|||
cols = row.select("td"); |
|||
|
|||
//Create a copy of Stat list
|
|||
ArrayList<Stat> loadStat = new ArrayList<Stat>(); |
|||
|
|||
double totalPoints = 0.0; |
|||
//parcours les colonnes contenant les valeurs---- Create stat
|
|||
for (int k = 0; k < cols.size(); k++) { |
|||
|
|||
for (int b = 0; b <= l1.loopStatsTeam; b++) { |
|||
//skip les 2 stats de pourcentage splitté---décalage de 2 col entre ligne stat et ligne valeur
|
|||
if(l1.loadStatBaseTeam.get(b).getName().equals(colsStatName.get(k).text())){ |
|||
|
|||
//System.out.println(l1.loadStatBaseTeam.get(b).getName());
|
|||
|
|||
loadStat.add(new Stat(l1.loadStatBaseTeam.get(b).getName())); |
|||
loadStat.get(b).setValRot(Double.parseDouble(cols.get(k).text())); |
|||
totalPoints += loadStat.get(b).getValRot() ; |
|||
loadStat.get(b).setTeam(nomTeam); |
|||
//create stat MADE / ATTEMPT
|
|||
if(loadStat.get(b).getName().contains("%")){ |
|||
loadStat.add(new Stat(l1.loadStatBaseTeam.get(b+1).getName())); |
|||
loadStat.get(b+1).setTeam(nomTeam); |
|||
|
|||
} |
|||
|
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
//associate stats with created team
|
|||
leagueTeams.get(nbTeam).setStats(loadStat); |
|||
leagueTeams.get(nbTeam).setTotalrotPts(totalPoints); |
|||
|
|||
|
|||
} |
|||
|
|||
l1.setNbTeams(Teams.getNumOfInstances()); |
|||
|
|||
|
|||
//-----------------go through season total chart
|
|||
for (int i = 2; i <= rows.size()-1 ; i++) { //first row is the col names so skip it.
|
|||
|
|||
// go through team table
|
|||
table = doc.select("table").get(1); //select the first table.
|
|||
rows = table.select("tr"); |
|||
row = rows.get(i); |
|||
cols = row.select("td"); |
|||
|
|||
System.out.println("team : " + cols.get(1)); |
|||
|
|||
nomTeam = cols.get(1).text(); |
|||
|
|||
for(Teams team : leagueTeams) { |
|||
if (team.getName().equals(nomTeam)) { |
|||
nbTeam = team.getCode(); |
|||
break; |
|||
} |
|||
} |
|||
|
|||
table = doc.select("table").get(9); //select the first table.
|
|||
rows = table.select("tr"); |
|||
row = rows.get(i); |
|||
cols = row.select("td"); |
|||
int nbGames = Integer.parseInt(cols.get(0).text()); |
|||
leagueTeams.get(nbTeam).setGamesPlayed(nbGames); |
|||
//create list of Slot
|
|||
leagueTeams.get(nbTeam).slots = new Slot[30]; |
|||
|
|||
table = doc.select("table").get(8); //select the first table.
|
|||
rows = table.select("tr"); |
|||
row = rows.get(i); |
|||
cols = row.select("td"); |
|||
for (int k = 0; k < cols.size(); k++) { |
|||
for (int b = 0; b < l1.loadStatBaseTeam.size(); b++) { |
|||
//stats starts at 1 in colsStatName
|
|||
//skip les 2 stats de pourcentage splitté - decalage de 2 entre col start et col valeur
|
|||
if (l1.loadStatBaseTeam.get(b).getName().equals(colsStatName.get(k).text())) { |
|||
if (l1.loadStatBaseTeam.get(b).getName().contains("%")) { |
|||
leagueTeams.get(nbTeam).stats.get(b).setValRelative(Float.parseFloat(cols.get(k).text())*100); |
|||
} else { // sinon calcul le relatif
|
|||
|
|||
|
|||
leagueTeams.get(nbTeam).stats.get(b).setValSeason(cols.get(k).text()); |
|||
|
|||
System.out.println(leagueTeams.get(nbTeam).getName()); |
|||
System.out.println(leagueTeams.get(nbTeam).stats.get(b).getName()); |
|||
System.out.println(leagueTeams.get(nbTeam).stats.get(b).getValSeason()); |
|||
|
|||
//calculate relative stat skip FT% & FG%
|
|||
if (nbGames != 0 && isDouble(cols.get(k).text())) { |
|||
int totStat = Integer.parseInt(cols.get(k).text()); |
|||
float totStatrel = (float) totStat / nbGames; |
|||
leagueTeams.get(nbTeam).stats.get(b).setValRelative(totStatrel); |
|||
} |
|||
|
|||
System.out.println(leagueTeams.get(nbTeam).stats.get(b).getValRelative()); |
|||
|
|||
} |
|||
} |
|||
|
|||
|
|||
//si / load from db
|
|||
if (l1.loadStatBaseTeam.get(b).getName().contains("/")) { |
|||
String valSeas = dao.rebuildMA(leagueTeams.get(nbTeam), l1.loadStatBaseTeam.get(b).getName()); |
|||
leagueTeams.get(nbTeam).stats.get(b).setValSeason(valSeas); |
|||
} |
|||
|
|||
} |
|||
} |
|||
System.out.println(cols.get(1).text()); |
|||
} |
|||
System.out.println("yo"); |
|||
} catch (IOException e) { |
|||
JOptionPane.showMessageDialog(null, "ESPN not respondig ... try again later"); |
|||
e.printStackTrace(); |
|||
|
|||
} |
|||
|
|||
|
|||
if(leagueTeams.get(0).getGamesPlayed() == 0) { |
|||
// --------------------if teams stats are empty (games in progress) LOAD DATA from DB
|
|||
for (int t = 0; t < l1.nbTeams; t++) { |
|||
List<Stat> records = dao.getRecordsList(leagueTeams.get(t), dao.getLastPeriod()); |
|||
// go through record list------------record LOOP--------
|
|||
int d =0; |
|||
for (int i = 0; i < records.size(); i ++) { //first rows
|
|||
//----Get Record list from the DB ------ recréer et affecte un stat
|
|||
leagueTeams.get(t).stats.get(i+d).setValRelative(records.get(i).getValRelative()); |
|||
leagueTeams.get(t).stats.get(i+d).setRank(records.get(i).getRank()); |
|||
if(records.get(i).getName().contains("%")) { |
|||
d++; |
|||
} |
|||
|
|||
} |
|||
} |
|||
} |
|||
|
|||
//ajoute la liste d'équipe a la lique
|
|||
l1.setLeagueTeams(leagueTeams); |
|||
//resize array to fit nb team
|
|||
//l1.leagueTeams = Arrays.copyOf(l1.leagueTeams, l1.nbTeams);
|
|||
|
|||
|
|||
new ImportVars(); |
|||
|
|||
//enregistre le ranking relatif si nouveau
|
|||
int d1 = l1.getNbDaysPlayed(); //new Date();
|
|||
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); // here set the pattern as you date in string was containing like date/month/year
|
|||
int d2 = dao.getLastPeriod(); |
|||
String day1 = sdf.format(d1); |
|||
String day2 = sdf.format(d2); |
|||
|
|||
if (d1 == d2 + 1 && l1.leagueTeams.get(0).getGamesPlayed() != 0 && l1.leagueTeams.get(0).stats.get(4).getValRelative() != 0) { |
|||
/*int nbRec = dao.nbDay() + 1; |
|||
for (int i = 0; i < Teams.getNumOfInstances(); i++) { |
|||
for (int j = 0; j <= l1.loopStatsTeam; j++) { |
|||
if (!l1.loadStatBaseTeam.get(j).getName().contains("/")) { |
|||
|
|||
System.out.println(l1.leagueTeams.get(i).getName() + "/" + l1.leagueTeams.get(i).stats.get(j).getRank()); |
|||
dao.addRecord(l1.leagueTeams.get(i).stats.get(j), l1.leagueTeams.get(i), nbRec, l1.getNbDaysPlayed()); |
|||
} |
|||
} |
|||
}*/ |
|||
}else { |
|||
|
|||
|
|||
} |
|||
|
|||
new ImportLineups(); |
|||
|
|||
//----------------------fill stat ranks
|
|||
RANKS_fill.fillStatRank(); |
|||
//float[] arrVal = RANKS_fill.fillStatRankTEST();
|
|||
//-------------fill team ranks---------------
|
|||
RANKS_fill.fillTeamRank(); |
|||
//float[] arrVal2 = RANKS_fill.fillTeamRankTEST();
|
|||
|
|||
new GRAPH_rebuild(); |
|||
//can graph init
|
|||
|
|||
|
|||
|
|||
// FILL MAXPACE-------------------------------------------------
|
|||
float slotMax = CALL_Fantasy.l1.nbTotalDays; |
|||
float seasonPercent = CALL_Fantasy.l1.nbDaysPlayed / slotMax; |
|||
float pacePercent = 82 * seasonPercent; |
|||
float pacePercentUtil = 82 * 3 * seasonPercent; |
|||
for(Teams team : CALL_Fantasy.l1.leagueTeams) { |
|||
for(Slot slot : team.slots) { |
|||
if (!slot.getNomPos().equals("UTIL")) { |
|||
slot.setGamesPlayed(CALL_Fantasy.dao.countSLOT(team, slot.getSlotID())/CALL_Fantasy.l1.nbStatsPlayer); |
|||
double pace = slot.getGamesPlayed() - pacePercent; |
|||
slot.setPace(pace); |
|||
}else { |
|||
int utilCount = CALL_Fantasy.dao.countSLOT(team, slot.getSlotID())/CALL_Fantasy.l1.nbStatsPlayer + CALL_Fantasy.dao.countSLOT(team, slot.getSlotID()+1)/CALL_Fantasy.l1.nbStatsPlayer +CALL_Fantasy.dao.countSLOT(team, slot.getSlotID()+2)/CALL_Fantasy.l1.nbStatsPlayer; |
|||
slot.setGamesPlayed(utilCount); |
|||
double pace = slot.getGamesPlayed() - pacePercentUtil; |
|||
slot.setPace(pace); |
|||
break; |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
private Object getWebKit() { |
|||
// TODO Auto-generated method stub
|
|||
return null; |
|||
} |
|||
|
|||
boolean isDouble(String str) { |
|||
try { |
|||
Double.parseDouble(str); |
|||
return true; |
|||
} catch (NumberFormatException e) { |
|||
return false; |
|||
} |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,113 @@ |
|||
package jsoupImport; |
|||
|
|||
import functions.*; |
|||
import objects.Player; |
|||
import objects.Slot; |
|||
import objects.Stat; |
|||
|
|||
import org.jsoup.Jsoup; |
|||
import org.jsoup.nodes.Document; |
|||
import org.jsoup.nodes.Element; |
|||
import org.jsoup.select.Elements; |
|||
import org.openqa.selenium.By; |
|||
import org.openqa.selenium.support.ui.ExpectedConditions; |
|||
|
|||
import call_pages.CALL_Fantasy; |
|||
|
|||
import java.io.IOException; |
|||
import java.util.ArrayList; |
|||
|
|||
/** |
|||
* Created by LeJay on 19.02.2017. |
|||
*/ |
|||
|
|||
public class ImportVars extends CALL_Fantasy {//called from MainActivity
|
|||
|
|||
public ImportVars() { |
|||
|
|||
//new Thread(new Runnable() {
|
|||
// public void run() {
|
|||
Document doc; |
|||
String title; |
|||
int nbStat; |
|||
|
|||
driver.get("http://fantasy.espn.com/basketball/team?leagueId=" + l1.getCode() + |
|||
"&teamId=" + l1.leagueTeams.get(1).getID() + "&statSplit=currSeason");// + "&seasonId=" + l1.getSeason() +
|
|||
//"&scoringPeriodId=" + l1.getNbDaysPlayed() + "&statSplit=singleScoringPeriodn");
|
|||
|
|||
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@class='jsx-2810852873 table--cell opp ml4']")));// instead of id u can use cssSelector or xpat
|
|||
String content = driver.getPageSource(); |
|||
|
|||
doc = Jsoup.parse(content); |
|||
|
|||
Elements days = doc.select("div.jsx-1917748593.custom--day"); //select the first table.
|
|||
|
|||
int nbdays = 0; |
|||
int currentnbdays = 0; |
|||
for (Element day : days) { |
|||
if (day.attr("class").contains("is-current")) { |
|||
currentnbdays=nbdays;} |
|||
nbdays+=1; |
|||
} |
|||
|
|||
l1.setNbDaysPlayed(currentnbdays); |
|||
l1.setnbTotalDays(nbdays); |
|||
|
|||
//select player name table
|
|||
Element tablePlayer = doc.select("table.Table2__right-aligned.Table2__table-fixed.Table2__Table--fixed--left.Table2__table").get(0); //select the first table.
|
|||
Elements rowsPlayer = tablePlayer.select("tr"); |
|||
Element rowPlayer; |
|||
Elements colsPlayer; |
|||
|
|||
//select stat table
|
|||
Element tableStat = doc.select("table.Table2__table-scroller.Table2__right-aligned.Table2__table").get(0); //select the first table.
|
|||
Elements rowsStat = tableStat.select("tr"); |
|||
Element rowStat; |
|||
Elements colsStat; |
|||
|
|||
|
|||
if (l1.loadStatBasePlayer.size()==0){ |
|||
//'-------------create and fill Stats name'
|
|||
|
|||
rowStat = doc.select("tr.Table2__header-row.Table2__tr.Table2__even").get(4); |
|||
colsStat = rowStat.select("th"); |
|||
for (int k = 1; k < colsStat.size()-1; k++) { |
|||
l1.loadStatBasePlayer.add(new Stat(colsStat.get(k).text())); |
|||
} |
|||
l1.setNbStatsPlayer(l1.loadStatBasePlayer.size()-2); |
|||
} |
|||
|
|||
|
|||
|
|||
int nbSlot = 0; |
|||
// go through SLOT list------------Slot LOOP--------
|
|||
for (int i = 2; i < rowsPlayer.size(); i++) { //first rows
|
|||
|
|||
rowPlayer = rowsPlayer.get(i); |
|||
colsPlayer = rowPlayer.select("td"); |
|||
|
|||
rowStat = rowsStat.get(i); |
|||
colsStat = rowStat.select("td"); |
|||
|
|||
//recup le nom du slot
|
|||
String slotName = colsPlayer.get(0).text(); |
|||
|
|||
for (int t = 0; t < l1.nbTeams; t++) { |
|||
l1.leagueTeams.get(t).slots[nbSlot] = new Slot(slotName); |
|||
l1.leagueTeams.get(t).slots[nbSlot].setSlotID(nbSlot); |
|||
l1.leagueTeams.get(t).slots[nbSlot].players = (new Player[l1.nbTotalDays]); |
|||
} |
|||
|
|||
nbSlot += 1; |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,57 @@ |
|||
package jsoupImport; |
|||
|
|||
import java.io.BufferedReader; |
|||
import java.io.IOException; |
|||
import java.io.InputStreamReader; |
|||
import java.net.URL; |
|||
import java.text.MessageFormat; |
|||
import java.util.concurrent.ExecutorService; |
|||
import java.util.concurrent.Executors; |
|||
import java.util.concurrent.TimeUnit; |
|||
import java.util.concurrent.atomic.AtomicInteger; |
|||
|
|||
import javax.servlet.RequestDispatcher; |
|||
import javax.servlet.ServletException; |
|||
import javax.servlet.annotation.WebServlet; |
|||
import javax.servlet.http.HttpServlet; |
|||
import javax.servlet.http.HttpServletRequest; |
|||
import javax.servlet.http.HttpServletResponse; |
|||
|
|||
import call_pages.CALL_Fantasy; |
|||
import functions.PROJ_analysis; |
|||
import objects.Teams; |
|||
|
|||
@WebServlet("/LoadTester") |
|||
public class LoadTester extends HttpServlet { |
|||
|
|||
public static final AtomicInteger counter = new AtomicInteger(0); |
|||
public static final int maxThreadCount = 100; |
|||
|
|||
/** |
|||
* @see HttpServlet#HttpServlet() |
|||
*/ |
|||
public LoadTester() throws InterruptedException { |
|||
super(); |
|||
// TODO Auto-generated constructor stub
|
|||
|
|||
} |
|||
/** |
|||
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) |
|||
*/ |
|||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { |
|||
|
|||
|
|||
new ImportPlayerStats();//needed for test fa
|
|||
//new ImportLineups();//--> PROJ_analysis : needed for fillPlayerRKinTeam
|
|||
} |
|||
|
|||
/** |
|||
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) |
|||
*/ |
|||
//appelé lors clic btn trade
|
|||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { |
|||
|
|||
|
|||
} |
|||
|
|||
}//end class ComplexLoadTester
|
|||
Binary file not shown.
Binary file not shown.
@ -0,0 +1,59 @@ |
|||
package objects; |
|||
|
|||
import java.util.ArrayList; |
|||
|
|||
/** |
|||
* Created by LeJay on 19.02.2017. |
|||
*/ |
|||
|
|||
public class League { |
|||
|
|||
private String name; |
|||
private int code; |
|||
private int season; |
|||
public ArrayList<Teams> leagueTeams = new ArrayList<Teams>(); |
|||
public ArrayList<Player> leaguePlayers = new ArrayList<Player>(); |
|||
public String selectedT; |
|||
public int nbDaysPlayed; |
|||
public int nbTotalDays; |
|||
public int nbTeams; |
|||
public int nbStatsPlayer; |
|||
public int nbStatsTeam; |
|||
public int loopStatsTeam; |
|||
public ArrayList<Stat> loadStatBaseTeam = new ArrayList<Stat>(); |
|||
public ArrayList<Stat> loadStatBasePlayer = new ArrayList<Stat>(); |
|||
public static int nbPtoCnt=10; |
|||
public static int nbGS=82; |
|||
public static int nbGR; |
|||
public static int nbGP; |
|||
// constructor
|
|||
public League(String name, String league, String year) { |
|||
this.name = name; |
|||
this.code = Integer.parseInt(league); |
|||
this.season = Integer.parseInt(year); |
|||
} |
|||
|
|||
// getter
|
|||
public String getName() { return name; } |
|||
public int getCode() { return code; } |
|||
public ArrayList<Teams> getLeagueTeams() { return leagueTeams; } |
|||
public ArrayList<Player> getLeaguePlayers() { return leaguePlayers; } |
|||
public int getSeason() { return season; } |
|||
public String getSelectedT() { return selectedT; } |
|||
public int getNbDaysPlayed() { return nbDaysPlayed; } |
|||
public int getNbTotalDays() { return nbTotalDays; } |
|||
|
|||
// setter
|
|||
public void setName(String name) { this.name = name; } |
|||
public void setCode(int code) { this.code = code; } |
|||
public void setLeagueTeams(ArrayList<Teams> leagueTeams) { this.leagueTeams = leagueTeams; } |
|||
public void setLeaguePlayers(ArrayList<Player> leaguePlayers) { this.leaguePlayers = leaguePlayers; } |
|||
public void setSeason(int season) { this.season = season; } |
|||
public void setSelectedT(String selectedT) { this.selectedT = selectedT; } |
|||
public void setNbDaysPlayed(int nbDaysPlayed) { this.nbDaysPlayed = nbDaysPlayed; } |
|||
public void setnbTotalDays(int nbTotalDays) { this.nbTotalDays = nbTotalDays; } |
|||
public void setNbTeams(int nbTeams) { this.nbTeams = nbTeams; } |
|||
public void setNbStatsPlayer(int nbStatsPlayer) { this.nbStatsPlayer = nbStatsPlayer; } |
|||
public void setNbStatsTeam(int nbStatsTeam) { this.nbStatsTeam = nbStatsTeam; } |
|||
public void setLoopStatsTeam(int loopStatsTeam) { this.loopStatsTeam = loopStatsTeam; } |
|||
} |
|||
@ -0,0 +1,89 @@ |
|||
package objects; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.ArrayList; |
|||
|
|||
/** |
|||
* Created by LeJay on 19.02.2017. |
|||
*/ |
|||
|
|||
public class Player implements Serializable, Comparable<Player>{ |
|||
|
|||
public int ID; |
|||
public int teamID; |
|||
public String nom; |
|||
public String franchise; |
|||
public String[] positions; |
|||
public ArrayList<Stat> stats = new ArrayList<Stat>(); |
|||
public Boolean isFA = true; |
|||
public Boolean inTrade = false; |
|||
public Boolean isToCount = true; |
|||
public double interRK; |
|||
private float interVal; |
|||
private float valToRank; |
|||
private double potPoint; |
|||
private double potRK; |
|||
public boolean faToCalculate = true; |
|||
public int orgTeamID; |
|||
|
|||
|
|||
private int TPTS; |
|||
private int GMP; |
|||
|
|||
private static int counter; |
|||
|
|||
// constructor
|
|||
public Player(String nom) { |
|||
this.nom = nom; |
|||
counter++; |
|||
} |
|||
|
|||
@Override |
|||
public int compareTo(Player o) { |
|||
double compareQuantity = ((Player) o).getValToRank(); |
|||
double d = this.getValToRank() - compareQuantity; |
|||
int i = (int) d; |
|||
//ascending order
|
|||
return i; |
|||
} |
|||
|
|||
// getter
|
|||
public int getteamID() {return teamID;} |
|||
public String getnom() {return nom;} |
|||
public int getTPTS() {return TPTS;} |
|||
public int getGMP() {return GMP;} |
|||
public String[] getPosition() {return positions;} |
|||
public String getFranchise() {return franchise;} |
|||
public ArrayList<Stat> getStats() {return stats;} |
|||
public static int getNumOfInstances() { |
|||
return counter; |
|||
} |
|||
public boolean getIsFA() {return isFA;} |
|||
public boolean getInTrade() { return inTrade; } |
|||
public float getValToRank() { return valToRank; } |
|||
public String[] getPositions() { return positions; } |
|||
public double getInterRK() {return interRK;} |
|||
public double getPotPoint() {return potPoint;} |
|||
public double getPotRK() {return potRK;} |
|||
public float getInterVal() {return interVal;} |
|||
public boolean getFaToCalculate() {return faToCalculate;} |
|||
public int getOrgTeamID() {return orgTeamID;} |
|||
// setter
|
|||
public void setteamID(int team) {this.teamID = teamID;} |
|||
public void setnom(String nom) {this.nom = nom;} |
|||
public void setTPTS(int TPTS) {this.TPTS = TPTS;} |
|||
public void setGMP(int GMP) {this.GMP = GMP;} |
|||
public void setPositions(String[] positions) {this.positions = positions;} |
|||
public void setFranchise(String franchise) {this.franchise = franchise;} |
|||
public void setStats(ArrayList<Stat> stats) {this.stats = stats;} |
|||
public void setIsFA(boolean isFA) {this.isFA = isFA;} |
|||
public void setInTrade(boolean inTrade) { this.inTrade = inTrade; } |
|||
public void setValToRank(float valToRank) { this.valToRank = valToRank; } |
|||
public void setInterRK(double interRK) {this.interRK = interRK;} |
|||
public void setInterVal(float interVal) {this.interVal = interVal;} |
|||
public void setPotPoint(double potPoint) {this.potPoint = potPoint;} |
|||
public void setPotRK(double potRK) {this.potRK = potRK;} |
|||
public void setFaToCalculate(boolean faToCalculate) {this.faToCalculate = faToCalculate;} |
|||
public void setOrgTeamID(int orgTeamID) {this.orgTeamID = orgTeamID;} |
|||
} |
|||
|
|||
@ -0,0 +1,78 @@ |
|||
package objects; |
|||
|
|||
import java.util.ArrayList; |
|||
|
|||
public class Record { |
|||
|
|||
private int id; |
|||
private int ptsPlayer1; |
|||
private int ptsPlayer2; |
|||
private int ptsPlayer3; |
|||
private int ptsPlayer4; |
|||
private int ptsPlayer5; |
|||
private int ptsPlayer6; |
|||
|
|||
public Record(int id, int ptsPlayer1, int ptsPlayer2, int ptsPlayer3, int ptsPlayer4, int ptsPlayer5, |
|||
int ptsPlayer6) { |
|||
super(); |
|||
this.id = id; |
|||
this.ptsPlayer1 = ptsPlayer1; |
|||
this.ptsPlayer2 = ptsPlayer2; |
|||
this.ptsPlayer3 = ptsPlayer3; |
|||
this.ptsPlayer4 = ptsPlayer4; |
|||
this.ptsPlayer5 = ptsPlayer5; |
|||
this.ptsPlayer6 = ptsPlayer6; |
|||
} |
|||
|
|||
public int getPtsPlayer1() { |
|||
return ptsPlayer1; |
|||
} |
|||
|
|||
public void setPtsPlayer1(int ptsPlayer1) { |
|||
this.ptsPlayer1 = ptsPlayer1; |
|||
} |
|||
|
|||
public int getPtsPlayer2() { |
|||
return ptsPlayer2; |
|||
} |
|||
|
|||
public void setPtsPlayer2(int ptsPlayer2) { |
|||
this.ptsPlayer2 = ptsPlayer2; |
|||
} |
|||
|
|||
public int getPtsPlayer3() { |
|||
return ptsPlayer3; |
|||
} |
|||
|
|||
public void setPtsPlayer3(int ptsPlayer3) { |
|||
this.ptsPlayer3 = ptsPlayer3; |
|||
} |
|||
|
|||
public int getPtsPlayer4() { |
|||
return ptsPlayer4; |
|||
} |
|||
|
|||
public void setPtsPlayer4(int ptsPlayer4) { |
|||
this.ptsPlayer4 = ptsPlayer4; |
|||
} |
|||
|
|||
public int getPtsPlayer5() { |
|||
return ptsPlayer5; |
|||
} |
|||
|
|||
public void setPtsPlayer5(int ptsPlayer5) { |
|||
this.ptsPlayer5 = ptsPlayer5; |
|||
} |
|||
|
|||
public int getPtsPlayer6() { |
|||
return ptsPlayer6; |
|||
} |
|||
|
|||
public void setPtsPlayer6(int ptsPlayer6) { |
|||
this.ptsPlayer6 = ptsPlayer6; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
package objects; |
|||
|
|||
/** |
|||
* Created by LeJay on 19.02.2017. |
|||
*/ |
|||
|
|||
public class Slot { |
|||
|
|||
public String nomPos; |
|||
public int slotID; |
|||
public Player[] players; |
|||
|
|||
public int gamesRemaining; |
|||
public int gamesPlayed; |
|||
public double pace; |
|||
|
|||
public Slot(String nomPos){ |
|||
this.nomPos = nomPos; |
|||
} |
|||
|
|||
public String getNomPos() { return nomPos; } |
|||
public Player[] getPlayers() { return players; } |
|||
public int getGamesRemaining() { return gamesRemaining; } |
|||
public int getGamesPlayed() { return gamesPlayed; } |
|||
public double getPace() { return pace; } |
|||
|
|||
public int getSlotID() { return slotID; } |
|||
|
|||
public void setNomPos(String nomPos) { this.nomPos = nomPos; } |
|||
public void setPlayers(Player[] players) { this.players = players; } |
|||
public void setGamesRemaining(int nom) { this.gamesRemaining = gamesRemaining; } |
|||
public void setGamesPlayed(int gamesPlayed) { this.gamesPlayed = gamesPlayed; } |
|||
public void setPace(double pace) { this.pace = pace; } |
|||
public void setSlotID(int slotID) { this.slotID = slotID; } |
|||
} |
|||
@ -0,0 +1,80 @@ |
|||
package objects; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* Created by LeJay on 19.02.2017. |
|||
*/ |
|||
|
|||
public class Stat implements Serializable, Comparable<Stat>{ |
|||
|
|||
private String name; |
|||
private int code; |
|||
private String team; |
|||
private double valRot; |
|||
private String valSeason; |
|||
private float valRelative; |
|||
private String ValProjection; |
|||
private double rank; |
|||
private double projectedRK; |
|||
private String statVal; |
|||
private String player; |
|||
private String slot; |
|||
private int slotID; |
|||
private int period; |
|||
private float valToRank; |
|||
|
|||
|
|||
public Stat(String name) { |
|||
this.name = name; |
|||
} |
|||
|
|||
@Override |
|||
public int compareTo(Stat o) { |
|||
|
|||
float compareQuantity = ((Stat) o).getValToRank(); |
|||
|
|||
float d = this.getValToRank() - compareQuantity; |
|||
int i = (int) d; |
|||
|
|||
//ascending order
|
|||
return i; |
|||
|
|||
//descending order
|
|||
//return compareQuantity - this.quantity;
|
|||
} |
|||
|
|||
// getter
|
|||
public String getName() { return name; } |
|||
public String getTeam() { return team; } |
|||
public double getValRot() { return valRot; } |
|||
public String getValSeason() { return valSeason; } |
|||
public float getValRelative() { return valRelative; } |
|||
public double getRank() { return rank; } |
|||
public double getCode() { return code; } |
|||
public String getStatVal() { return statVal; } |
|||
public String getPlayer() { return player; } |
|||
public String getSlot() { return slot; } |
|||
public int getSlotID() { return slotID; } |
|||
public int getPeriod() { return period; } |
|||
public String getValProjection() { return ValProjection; } |
|||
public float getValToRank() { return valToRank; } |
|||
public double getProjectedRK() { return projectedRK; } |
|||
|
|||
// setter
|
|||
public void setName(String name) { this.name = name; } |
|||
public void setTeam(String team) { this.team = team; } |
|||
public void setValRot(double valRot) { this.valRot = valRot; } |
|||
public void setValSeason(String valSeason) { this.valSeason = valSeason; } |
|||
public void setValRelative(float valRelative) { this.valRelative = valRelative; } |
|||
public void setRank(double rank) { this.rank = rank; } |
|||
public void setCode(int code) { this.code = code; } |
|||
public void setStatVal(String statVal) { this.statVal = statVal; } |
|||
public void setPlayer(String player) { this.player = player; } |
|||
public void setSlot(String slot) { this.slot = slot; } |
|||
public void setSlotID(int slotID) { this.slotID = slotID; } |
|||
public void setPeriod(int period) { this.period = period; } |
|||
public void setValProjection(String valProjection) { this.ValProjection = valProjection; } |
|||
public void setValToRank(float valToRank) { this.valToRank = valToRank; } |
|||
public void setProjectedRK(double projectedRK) { this.projectedRK = projectedRK; } |
|||
} |
|||
@ -0,0 +1,111 @@ |
|||
package objects; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.ArrayList; |
|||
|
|||
/** |
|||
* Created by LeJay on 19.02.2017. |
|||
*/ |
|||
|
|||
public class Teams implements Serializable, Comparable<Teams>{ |
|||
|
|||
private String name; |
|||
private String surn; |
|||
private String nomJoueur; |
|||
public int code; |
|||
private int ID; |
|||
//public LineUp[] lineup;
|
|||
public ArrayList<Stat> stats = new ArrayList<Stat>(); |
|||
public ArrayList<Player> players = new ArrayList<Player>(); |
|||
public Slot[] slots; |
|||
|
|||
private int gamesPlayed; |
|||
private double totalrotPts; |
|||
private double totalrotPtsRel; |
|||
private double RK; |
|||
private double relativeRK; |
|||
private double projTot; |
|||
private double projTotX; |
|||
private double projRK; |
|||
private double projRKX; |
|||
private float valToRank; |
|||
private boolean inTrade; |
|||
|
|||
public String selectedP; |
|||
|
|||
|
|||
private static int counter; |
|||
|
|||
//TeamStats rotisserie= new TeamStats(,0,0,0,0,0,0,0,0,0,0,0);
|
|||
//TeamStats season= new TeamStats(,0,0,0,0,0,0,0,0,0,0,0);
|
|||
public static int getNumOfInstances() { |
|||
return counter; |
|||
} |
|||
|
|||
// constructor
|
|||
public Teams(String name, int code) { |
|||
this.name = name; |
|||
this.code = code; |
|||
counter++; |
|||
} |
|||
|
|||
|
|||
@Override |
|||
public int compareTo(Teams o) { |
|||
|
|||
double compareQuantity = ((Teams) o).getValToRank(); |
|||
double d = this.getValToRank() - compareQuantity; |
|||
|
|||
int i = (int) d; |
|||
|
|||
//ascending order
|
|||
return i; |
|||
//descending order
|
|||
//return compareQuantity - this.quantity;
|
|||
} |
|||
|
|||
// getter
|
|||
public String getName() { return name; } |
|||
public String getSurn() { return surn; } |
|||
public String getNomJoueur() { return nomJoueur; } |
|||
public int getCode() { return code; } |
|||
public ArrayList<Stat> getStats() { return stats; } |
|||
public double getTotalrotPts() { return totalrotPts; } |
|||
public double getTotalrotPtsRel() { return totalrotPtsRel; } |
|||
public int getGamesPlayed() { return gamesPlayed; } |
|||
public double getRelativeRK() { return relativeRK; } |
|||
public double getProjTot() { return projTot; } |
|||
public double getProjRK() { return projRK; } |
|||
public double getProjTotX() { return projTotX; } |
|||
public double getProjRKX() { return projRKX; } |
|||
public float getValToRank() { return valToRank; } |
|||
public ArrayList<Player> getPlayer() { return players; } |
|||
public int getID() { return ID; } |
|||
public boolean getInTrade() { return inTrade; } |
|||
public String getSelectedP() { return selectedP; } |
|||
public double getRK() {return RK;} |
|||
public Slot[] getSlots() {return slots;} |
|||
|
|||
// setter
|
|||
public void setName(String name) { this.name = name; } |
|||
public void setSurn(String surn) { this.surn = surn; } |
|||
public void setNomJoueur(String surn) { this.nomJoueur = nomJoueur; } |
|||
public void setCode(int code) { this.code = code; } |
|||
public void setStats(ArrayList<Stat> stats) { this.stats = stats; } |
|||
public void setTotalrotPts(double totalrotPts) { this.totalrotPts = totalrotPts; } |
|||
public void setTotalrotPtsRel(double totalrotPtsRel) { this.totalrotPtsRel = totalrotPtsRel; } |
|||
public void setGamesPlayed(int gamesPlayed) { this.gamesPlayed = gamesPlayed; } |
|||
public void setRelativeRK(double relativeRK) { this.relativeRK = relativeRK; } |
|||
public void setProjTot(double projTot) { this.projTot = projTot; } |
|||
public void setProjRK(double projRK) { this.projRK = projRK; } |
|||
public void setProjTotX(double projTotX) { this.projTotX = projTotX; } |
|||
public void setProjRKX(double projRKX) { this.projRKX = projRKX; } |
|||
public void setValToRank(float valToRank) { this.valToRank = valToRank; } |
|||
public void setPlayers(ArrayList<Player> players) { this.players = players; } |
|||
public void setID(int ID) { this.ID = ID; } |
|||
// public void setSlots(ArrayList<Slot> slots) { this.slots = slots; }
|
|||
public void setInTrade(boolean inTrade) { this.inTrade = inTrade; } |
|||
public void setSelectedP(String selectedP) {this.selectedP = selectedP; } |
|||
public void setRK(double RK) {this.RK = RK;} |
|||
public void setSlots(Slot[] slots) {this.slots = slots;} |
|||
} |
|||
Binary file not shown.
@ -0,0 +1,504 @@ |
|||
@charset "ISO-8859-1"; |
|||
|
|||
|
|||
.wrapper { |
|||
display: grid; |
|||
grid-template-columns: repeat(16, [col-start] 1fr); |
|||
grid-gap: 10px; |
|||
} |
|||
.wrapper > * { |
|||
grid-column: col-start / span 16; |
|||
} |
|||
.main-nav { |
|||
background: #f1f1f1; |
|||
-webkit-box-shadow: 0 10px 5px #888888; |
|||
-moz-box-shadow: 0 10px 5px #888888; |
|||
box-shadow: 0 10px 5px #888888; |
|||
} |
|||
.main-footer { |
|||
background: #ff8306; |
|||
} |
|||
|
|||
.main-head { |
|||
background: #ff8306; |
|||
} |
|||
|
|||
.cn { |
|||
display: flex; |
|||
justify-content: center; |
|||
align-items: center; |
|||
height:100%; |
|||
} |
|||
|
|||
@media (min-width: 500px) { |
|||
|
|||
.side { |
|||
grid-column: col-start / span 3; |
|||
grid-row: 3; |
|||
} |
|||
.ad { |
|||
grid-column: col-start / span 3; |
|||
grid-row: 4; |
|||
} |
|||
.content, .main-footer { |
|||
grid-column: col-start 4 / span 9; |
|||
} |
|||
nav ul { |
|||
display: flex; |
|||
justify-content: space-between; |
|||
} |
|||
} |
|||
|
|||
@media (min-width: 700px) { |
|||
|
|||
.main-head { |
|||
grid-column: col-start / span 16; |
|||
grid-row: 1; |
|||
} |
|||
.main-nav { |
|||
grid-column: col-start / span 2; |
|||
grid-row: 2 / 4; |
|||
} |
|||
|
|||
.graph { |
|||
grid-column: col-start 1 / span 16; |
|||
grid-row: 2; |
|||
} |
|||
|
|||
.team { |
|||
grid-column: col-start 1 / span 3; |
|||
grid-row: 2; |
|||
|
|||
} |
|||
.side { |
|||
grid-column: col-start 15 / span 2; |
|||
grid-row: 2; |
|||
} |
|||
.ad { |
|||
grid-column: col-start 15 / span 2; |
|||
grid-row: 3; |
|||
} |
|||
.main-footer { |
|||
grid-column: col-start / span 16; |
|||
} |
|||
nav ul { |
|||
flex-direction: column; |
|||
} |
|||
|
|||
.listing { |
|||
list-style: none; |
|||
display: grid; |
|||
grid-gap: 10px; |
|||
grid-auto-flow: dense; |
|||
grid-template-columns: repeat(auto-fill,minmax(350px, 1fr)); |
|||
padding:10px; |
|||
padding-top:0px; |
|||
margin:0px; |
|||
} |
|||
.listing li { |
|||
border: 1px solid #ffe066; |
|||
border-radius: 5px; |
|||
display: flex; |
|||
flex-direction: column; |
|||
background:#ffffff; |
|||
} |
|||
.listing .wide { |
|||
grid-column-end: span 2; |
|||
} |
|||
|
|||
.listingTeam { |
|||
list-style: none; |
|||
display: grid; |
|||
grid-gap: 10px; |
|||
grid-auto-flow: dense; |
|||
grid-template-columns: repeat(auto-fill,minmax(500px, 600px)); |
|||
padding:10px; |
|||
padding-top:0px; |
|||
margin:0px; |
|||
flex-direction: row; |
|||
} |
|||
.listingTeam li { |
|||
border: 1px solid #ffe066; |
|||
border-radius: 5px; |
|||
display: flex; |
|||
flex-direction: column; |
|||
background:#ffffff; |
|||
} |
|||
.listingTeam .wide { |
|||
grid-column-end: span 2; |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
body { |
|||
background: #ff8306; |
|||
color: #444; |
|||
font: 100%/20px 'Helvetica Neue', helvetica, arial, sans-serif; |
|||
text-shadow: 0 1px 0 #974b00; |
|||
-moz-user-select: -moz-none; |
|||
-webkit-user-select: none; |
|||
-khtml-user-select: none; |
|||
-o-user-select: none; |
|||
user-select: none; |
|||
} |
|||
.cadre |
|||
{ |
|||
background: #000051; |
|||
border: 5px solid #fff; |
|||
display: inline-block; |
|||
max-width: 100%; |
|||
padding-bottom: 10px; |
|||
} |
|||
|
|||
.HeaderDiv |
|||
{ |
|||
background: linear-gradient(#777, #444); |
|||
color: #fff; |
|||
text-shadow: 0 1px 0 #000; |
|||
font-size: 12px ; |
|||
font-weight: bold; |
|||
} |
|||
|
|||
.tableTrade { |
|||
background: #000051; |
|||
border-collapse: collapse; |
|||
font-size: 9px; |
|||
text-shadow: 0 1px 0 #ffffff; |
|||
line-height: 12px; |
|||
-ms-user-select:none; |
|||
width:100%; |
|||
|
|||
} |
|||
|
|||
.tableTrade > thead > tr > th |
|||
{ |
|||
border-right: 1px solid #fff; |
|||
border-left: 1px solid #e8e8e8; |
|||
font-weight: bold; |
|||
padding: 2px 1px; |
|||
position: relative; |
|||
text-shadow: 0 1px 0 #000; |
|||
font-size: 9px ; |
|||
|
|||
-ms-user-select:none; |
|||
} |
|||
|
|||
.tableTrade > thead > tr > th:first-child |
|||
{ |
|||
border-left: 0px solid ; |
|||
} |
|||
.tableTrade > thead > tr > th:last-child |
|||
{ |
|||
border-right: 0px solid ; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
.tableTrade > thead > tr.Header > th |
|||
{ |
|||
background: linear-gradient(#777, #444); |
|||
color: #fff; |
|||
text-align:center; |
|||
} |
|||
|
|||
.tableTrade > thead > tr.Header > th.focus { |
|||
background: linear-gradient(#959595, #d4d4d4); |
|||
cursor: pointer; |
|||
} |
|||
|
|||
.tableTrade > tbody > tr.ligneHead > th |
|||
{ |
|||
padding: 2px 3px; |
|||
border-right: 1px solid #fff; |
|||
border-left: 1px solid #e8e8e8; |
|||
background: linear-gradient(#c0c0c0, #efefef); |
|||
color: #2b2b2b; |
|||
text-align:center; |
|||
} |
|||
.tableTrade > tbody > tr.ligneHead > th:first-child |
|||
{ |
|||
border-left: 0px solid ; |
|||
} |
|||
.tableTrade > tbody > tr.ligneHead > th:last-child |
|||
{ |
|||
border-right: 0px solid ; |
|||
} |
|||
|
|||
.tableTrade > tbody > tr > th.positive |
|||
{ |
|||
background: linear-gradient(#91ff91, #d5ffd5); |
|||
color: #004000; |
|||
} |
|||
.tableTrade > tbody > tr > th.negative |
|||
{ |
|||
background: linear-gradient(#ff8c8c, #ffd5d5); |
|||
color: #710000; |
|||
} |
|||
.tableTrade > tbody > tr > th.neutral |
|||
{ |
|||
background: linear-gradient(#ffdab5, #ffeedd); |
|||
color: #ff8306; |
|||
} |
|||
.tableTrade > tbody > tr.tab:nth-child(odd) > td.positive |
|||
{ |
|||
background: linear-gradient(#91ff91, #d5ffd5); |
|||
color: #004000; |
|||
} |
|||
.tableTrade > tbody > tr.tab:nth-child(odd) > td.negative |
|||
{ |
|||
background: linear-gradient(#ff8c8c, #ffd5d5); |
|||
color: #710000; |
|||
} |
|||
.tableTrade > tbody > tr.tab:nth-child(odd) > td.neutral |
|||
{ |
|||
background: linear-gradient(#ffdab5, #ffeedd); |
|||
color: #ff8306; |
|||
} |
|||
.tableTrade > tbody > tr.tab:nth-child(even) > td.positive |
|||
{ |
|||
background: linear-gradient(#91ff91, #d5ffd5); |
|||
color: #004000; |
|||
} |
|||
.tableTrade > tbody > tr.tab:nth-child(even) > td.negative |
|||
{ |
|||
background: linear-gradient(#ff8c8c, #ffd5d5); |
|||
color: #710000; |
|||
} |
|||
.tableTrade > tbody > tr.tab:nth-child(even) > td.neutral |
|||
{ |
|||
background: linear-gradient(#ffdab5, #ffeedd); |
|||
color: #ff8306; |
|||
} |
|||
|
|||
.tableTrade > tbody > tr.tab > td:hover { |
|||
background: linear-gradient(#c9c9c9, #eeeeee); |
|||
transition: all 300ms; |
|||
} |
|||
|
|||
.tableTrade > tbody > tr > td |
|||
{ |
|||
font-size: 9px ; |
|||
border-right: 1px solid #fff; |
|||
border-left: 1px solid #e8e8e8; |
|||
padding: 2px 1px; |
|||
position: relative; |
|||
transition: all 300ms; |
|||
text-align:center; |
|||
-ms-user-select:none; |
|||
} |
|||
.tableTrade > tbody > tr > td:first-child |
|||
{ |
|||
border-left: 0px solid ; |
|||
} |
|||
.tableTrade > tbody > tr > td:last-child |
|||
{ |
|||
border-right: 0px solid ; |
|||
} |
|||
|
|||
.tableTrade > tbody > tr.freeAgentInjured > td { |
|||
background: linear-gradient(#c0c0c0, #e6e6e6); |
|||
} |
|||
|
|||
.tableTrade > tbody > tr.tab:nth-child(odd) > td |
|||
{ |
|||
background: linear-gradient(#f3f3f3, #fafafa); |
|||
color: #2b2b2b; |
|||
} |
|||
.tableTrade > tbody > tr.tab:nth-child(even) > td |
|||
{ |
|||
background: linear-gradient(#f3f3f3, #ffffff); |
|||
color: #2b2b2b; |
|||
} |
|||
|
|||
.tableTrade > tbody > tr.tab:hover > td |
|||
{ |
|||
background: #8cffff; |
|||
cursor: pointer; |
|||
} |
|||
|
|||
|
|||
.tableTrade > tbody > tr:nth-child(odd).displayed > td |
|||
{ |
|||
background: linear-gradient(#26bf73, #7ae4af); |
|||
} |
|||
.tableTrade > tbody > tr:nth-child(even).displayed > td |
|||
{ |
|||
background: linear-gradient(#48db92, #a5edc9); |
|||
} |
|||
.tableTrade > tbody > tr:nth-child(odd).selected > td |
|||
{ |
|||
background-color: #9FAFD1; |
|||
} |
|||
.tableTrade > tbody > tr:nth-child(even).selected > td |
|||
{ |
|||
background-color: #B0BED9; |
|||
} |
|||
|
|||
|
|||
.tableTrade > tbody > tr.tab:nth-child(odd) > td |
|||
{ |
|||
background: linear-gradient(#f3f3f3, #fafafa); |
|||
color: #2b2b2b; |
|||
} |
|||
.tableTrade > tbody > tr.tab:nth-child(even) > td |
|||
{ |
|||
background: linear-gradient(#f3f3f3, #ffffff); |
|||
color: #2b2b2b; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
.tableTrade > tbody > tr.hidden |
|||
{ |
|||
display: none; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
strong { |
|||
font-weight: bold; |
|||
} |
|||
|
|||
em { |
|||
font-style: italic; |
|||
} |
|||
|
|||
|
|||
|
|||
.asc:after {content: "\25B2"; } |
|||
.desc:after {content: "\25BC"; } |
|||
|
|||
.focus { |
|||
background-color: #ff00ff; |
|||
color: #fff; |
|||
cursor: pointer; |
|||
font-weight: bold; |
|||
} |
|||
.selected { |
|||
background-color: #ff00ff; |
|||
color: #fff; |
|||
font-weight: bold; |
|||
} |
|||
|
|||
|
|||
#myInput { |
|||
background-image: url('../PICS/searchicon.png'); /* Add a search icon to input */ |
|||
background-position: 5px 6px; /* Position the search icon */ |
|||
background-repeat: no-repeat; /* Do not repeat the icon image */ |
|||
width: 100%; /* Full-width */ |
|||
font-size: 14px; /* Increase font-size */ |
|||
padding: 6px 10px 6px 40px; /* Add some padding */ |
|||
border: 1px solid #ddd; /* Add a grey border */ |
|||
margin-bottom: 6px; /* Add some space below the input */ |
|||
margin-top: 6px; /* Add some space below the input */ |
|||
} |
|||
|
|||
.positive |
|||
{ |
|||
background: linear-gradient(#91ff91, #d5ffd5); |
|||
color: #004000; |
|||
} |
|||
.negative |
|||
{ |
|||
background: linear-gradient(#ff8c8c, #ffd5d5); |
|||
color: #710000; |
|||
} |
|||
.neutral |
|||
{ |
|||
background: linear-gradient(#ff9d3c, #ffc78e); |
|||
color: #ff8040; |
|||
} |
|||
|
|||
#everything-wrapper { |
|||
display : none; |
|||
} |
|||
|
|||
|
|||
span { |
|||
display: block; |
|||
margin: 0 auto; |
|||
} |
|||
|
|||
span[class*="l-"] { |
|||
height: 4px; width: 4px; |
|||
background: #000; |
|||
display: inline-block; |
|||
margin: 12px 2px; |
|||
|
|||
border-radius: 100%; |
|||
-webkit-border-radius: 100%; |
|||
-moz-border-radius: 100%; |
|||
|
|||
-webkit-animation: loader 4s infinite; |
|||
-webkit-animation-timing-function: cubic-bezier(0.030, 0.615, 0.995, 0.415); |
|||
-webkit-animation-fill-mode: both; |
|||
-moz-animation: loader 4s infinite; |
|||
-moz-animation-timing-function: cubic-bezier(0.030, 0.615, 0.995, 0.415); |
|||
-moz-animation-fill-mode: both; |
|||
-ms-animation: loader 4s infinite; |
|||
-ms-animation-timing-function: cubic-bezier(0.030, 0.615, 0.995, 0.415); |
|||
-ms-animation-fill-mode: both; |
|||
animation: loader 4s infinite; |
|||
animation-timing-function: cubic-bezier(0.030, 0.615, 0.995, 0.415); |
|||
animation-fill-mode: both; |
|||
} |
|||
|
|||
span.l-1 {-webkit-animation-delay: 1s;animation-delay: 1s;-ms-animation-delay: 1s;-moz-animation-delay: 1s;} |
|||
span.l-2 {-webkit-animation-delay: 0.8s;animation-delay: 0.8s;-ms-animation-delay: 0.8s;-moz-animation-delay: 0.8s;} |
|||
span.l-3 {-webkit-animation-delay: 0.6s;animation-delay: 0.6s;-ms-animation-delay: 0.6s;-moz-animation-delay: 0.6s;} |
|||
span.l-4 {-webkit-animation-delay: 0.4s;animation-delay: 0.4s;-ms-animation-delay: 0.4s;-moz-animation-delay: 0.4s;} |
|||
span.l-5 {-webkit-animation-delay: 0.2s;animation-delay: 0.2s;-ms-animation-delay: 0.2s;-moz-animation-delay: 0.2s;} |
|||
span.l-6 {-webkit-animation-delay: 0;animation-delay: 0;-ms-animation-delay: 0;-moz-animation-delay: 0;} |
|||
|
|||
@-webkit-keyframes loader { |
|||
0% {-webkit-transform: translateX(-30px); opacity: 0;} |
|||
25% {opacity: 1;} |
|||
50% {-webkit-transform: translateX(30px); opacity: 0;} |
|||
100% {opacity: 0;} |
|||
} |
|||
|
|||
@-moz-keyframes loader { |
|||
0% {-moz-transform: translateX(-30px); opacity: 0;} |
|||
25% {opacity: 1;} |
|||
50% {-moz-transform: translateX(30px); opacity: 0;} |
|||
100% {opacity: 0;} |
|||
} |
|||
|
|||
@-keyframes loader { |
|||
0% {-transform: translateX(-30px); opacity: 0;} |
|||
25% {opacity: 1;} |
|||
50% {-transform: translateX(30px); opacity: 0;} |
|||
100% {opacity: 0;} |
|||
} |
|||
|
|||
@-ms-keyframes loader { |
|||
0% {-ms-transform: translateX(-30px); opacity: 0;} |
|||
25% {opacity: 1;} |
|||
50% {-ms-transform: translateX(30px); opacity: 0;} |
|||
100% {opacity: 0;} |
|||
|
|||
|
|||
} |
|||
|
|||
|
|||
dfs{ |
|||
color: #f0f0f0; |
|||
} |
|||
|
|||
select { |
|||
font-size:16px; |
|||
cursor: pointer; |
|||
background: linear-gradient(#ffe6cc, #ffffff); |
|||
width :100%; |
|||
} |
|||
|
|||
|
|||
@ -0,0 +1,273 @@ |
|||
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" |
|||
pageEncoding="ISO-8859-1"%> |
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
|||
<link href="${pageContext.request.contextPath}/CSS/style.css" rel="stylesheet" type="text/css" > |
|||
|
|||
<title>team</title> |
|||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> |
|||
<%@ taglib uri = "http://java.sun.com/jsp/jstl/functions" prefix = "fn" %> |
|||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> |
|||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> |
|||
<script> |
|||
$(document).ready(function() { |
|||
|
|||
var ln = '${team1Stats.size()}'; |
|||
//color other team points |
|||
var tradeProjSel = $("td[name='tradeProjSel']"); |
|||
var actualProj = $("[name='actualProj']"); |
|||
var cat = $("[name='cat']"); |
|||
var z = 0; |
|||
for (x=0;x<$(tradeProjSel).size();x++){ |
|||
if(z==$(cat).size()){z=0;} |
|||
if($(cat).eq(z).text() == "RK-P"){ |
|||
var n = ""+(parseFloat($(tradeProjSel).eq(x).text()) - parseFloat($(actualProj).eq(z).text())); |
|||
if(n>0){ |
|||
$(tradeProjSel).eq(x).addClass("positive"); |
|||
$(tradeProjSel).eq(x-1).addClass("positive"); |
|||
}else if(n==0){ |
|||
$(tradeProjSel).eq(x).addClass("neutral"); |
|||
$(tradeProjSel).eq(x-1).addClass("neutral"); |
|||
}else{ |
|||
$(tradeProjSel).eq(x).addClass("negative"); |
|||
$(tradeProjSel).eq(x-1).addClass("negative"); |
|||
} |
|||
} |
|||
if(z > ln+2){ |
|||
var n = ""+(parseFloat($(tradeProjSel).eq(x).text()) - parseFloat($(actualProj).eq(z).text())); |
|||
if(n>0){ |
|||
$(tradeProjSel).eq(x).addClass("positive"); |
|||
}else if(n==0){ |
|||
$(tradeProjSel).eq(x).addClass("neutral"); |
|||
}else{ |
|||
$(tradeProjSel).eq(x).addClass("negative"); |
|||
} |
|||
} |
|||
z+=1; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
var sort = $("[title='filter']"); |
|||
$(sort).each(function(col) { |
|||
$(this).hover( |
|||
function() { $(this).addClass('focus'); }, |
|||
function() { $(this).removeClass('focus'); } |
|||
); |
|||
|
|||
if($(this).text()=="RK-P"){ |
|||
$(this).addClass('desc selected'); |
|||
}; |
|||
|
|||
$(this).click(function() { |
|||
if ($(this).is('.desc')) { |
|||
$(this).removeClass('desc'); |
|||
$(this).addClass('asc selected'); |
|||
sortOrder = 1; |
|||
} |
|||
else { |
|||
$(this).addClass('desc selected'); |
|||
$(this).removeClass('asc'); |
|||
sortOrder = -1; |
|||
} |
|||
$(this).siblings().removeClass('asc selected'); |
|||
$(this).siblings().removeClass('desc selected'); |
|||
|
|||
var arrData = $('table').find("tr[name='lignesResults']"); |
|||
/* var arrData = $('table').find('tbody:nth-of-type(2) > tr').get(); */ |
|||
|
|||
arrData.sort(function(a, b) { |
|||
var val1 = $(a).children('td').eq(col).text().replace("+","").toUpperCase(); |
|||
var val2 = $(b).children('td').eq(col).text().replace("+","").toUpperCase(); |
|||
if($.isNumeric(val1) && $.isNumeric(val2)) |
|||
return sortOrder == 1 ? val1-val2 : val2-val1; |
|||
else |
|||
return (val1 < val2) ? -sortOrder : (val1 > val2) ? sortOrder : 0; |
|||
}); |
|||
|
|||
|
|||
$.each(arrData, function(index, row) { |
|||
$('tbody:nth-of-type(3)').append(row); |
|||
}); |
|||
}); |
|||
}); |
|||
|
|||
|
|||
}); |
|||
|
|||
|
|||
</script> |
|||
|
|||
</head> |
|||
<body> |
|||
|
|||
|
|||
<c:set var="mainFA" value="${requestScope.mainFA}" /> |
|||
<c:set var="stats" value="${requestScope.statBase}" /> |
|||
<c:set var="team1" value="${requestScope.team1}" /> |
|||
<c:set var="team1Stats" value="${requestScope.team1Stats}" /> |
|||
<c:set var="otherTeamStats" value="${requestScope.otherTeamStats}" /> |
|||
<c:set var="nbTeam" value="${requestScope.nbTeam}" /> |
|||
|
|||
<table class="tableTrade"> |
|||
<thead> |
|||
<tr class="Header"> |
|||
<th colspan="2" ><c:out value="TEAM" /></th> |
|||
<th name="actualRK"><c:out value="Proj RK" /></th> |
|||
<th name="actualPTS"><c:out value="Proj PTS" /></th> |
|||
</tr> |
|||
</thead> |
|||
<tr class="ligneHead"> |
|||
<th colspan="2"><c:out value="${team1.name}" /></th> |
|||
<th name="actualRK"><fmt:formatNumber pattern="0.#" value="${team1.projRK}" /></th> |
|||
<th name="actualPTS"><fmt:formatNumber pattern="0.#" value="${team1.projTot}" /></th> |
|||
</tr> |
|||
|
|||
<thead> |
|||
<tr class="Header"> |
|||
<th><c:out value="Player RK" /></th> |
|||
<th align="left"><c:out value="Player" /></th> |
|||
<th ><c:out value="Pot RK" /></th> |
|||
<th ><c:out value="Pot PTS" /></th> |
|||
</tr> |
|||
|
|||
</thead> |
|||
<tbody > |
|||
<c:forEach var="player" items= "${players}" varStatus="i"> |
|||
<tr name="lignesPlayer" class="tab" id="${i.index}" onclick="return callfilterResults(this);"> |
|||
<td align="center"><fmt:formatNumber pattern="0.#" value="${player.interRK}" /></td> |
|||
<td align="left" name ="player"><c:out value="${player.nom}" /></td> |
|||
<td name="potRKcell" ><fmt:formatNumber pattern="0.#" value="${player.potRK}" /></td> |
|||
<td name="potPTScell" ><fmt:formatNumber pattern="0.#" value="${player.potPoint}" /></td> |
|||
</tr> |
|||
</c:forEach> |
|||
</tbody> |
|||
</table> |
|||
|
|||
<input type="text" id="myInput" onkeyup="filterName()" placeholder="Search for names.."> |
|||
|
|||
</div> |
|||
|
|||
<div id="fa_div" style="display: inline-block;vertical-align:top"> |
|||
|
|||
<table class="tableTrade"> |
|||
<thead > |
|||
<!---------------------- TAB HEADER-------------------------------> |
|||
<tr class="Header" > |
|||
<th name="statTab" colspan="${fn:length(team1Stats)+1}"><c:out value="Waiver impact" /></th> |
|||
<th name="teamTab" colspan="${nbTeam - 1}"><c:out value="Impact on other teams" /></th> |
|||
</tr> |
|||
<!----------------------------------------- STATS CAT ----------------> |
|||
<tr name="headers" class="Header" > |
|||
<th align="left" ><c:out value="Drop" /></th> |
|||
<th ><c:out value="Pot RK" /></th> |
|||
<c:forEach var="stat" items= "${stats}" > |
|||
<c:if test="${!fn:contains(stat.name,'/')}"> |
|||
<th ><c:out value="${fn:replace(stat.name,'Team ','')}" /></th> |
|||
</c:if> |
|||
</c:forEach> |
|||
</tr> |
|||
</thead> |
|||
<!------------------------------- LIGNE ACTUAL STATS PROJECTION--> |
|||
<tbody > |
|||
<tr name="headers" class="ligneHead" > |
|||
<c:forEach var="stat" items= "${team1Stats}" varStatus="i"> |
|||
<c:if test="${i.first}"> |
|||
<th name="actualPlayers">Actual Projection</th> |
|||
<th name="actualProj"><fmt:formatNumber pattern="0.#" value="${team1projectedRK}" /></th> |
|||
<th name="actualProj"><fmt:formatNumber pattern="0.#" value="${team1projTot}" /></th> |
|||
</c:if> |
|||
<c:if test="${!fn:contains(stat.name,'/')}"> |
|||
<th name="actualProj"><c:out value="${stat.valProjection}" /></th> |
|||
</c:if> |
|||
</c:forEach> |
|||
|
|||
<c:forEach var="stat" items= "${otherTeamStats}" > |
|||
<th name="actualProj"><c:out value="${stat}" /></th> |
|||
</c:forEach> |
|||
</tr> |
|||
|
|||
<!-- LIGNE WITH FA STATS PROJECTION--> |
|||
<tr name="headers" class="ligneHead" > |
|||
<c:forEach var="stat" items= "${stats}" varStatus="i"> |
|||
<c:if test="${stat.name == 'RK-P'}"> |
|||
<th name="tradePlayers" >Proj with FA</th> |
|||
<th name="tradeProj"><c:out value="--" /></th> |
|||
</c:if> |
|||
|
|||
<c:if test="${!stat.name.contains('/')}"> |
|||
<th name="tradeProj"><c:out value="--" /></th> |
|||
</c:if> |
|||
|
|||
</c:forEach> |
|||
</tr> |
|||
|
|||
<!------------- LIGNE DIFFERENCES -----> |
|||
<tr name="headers" class="ligneHead" > |
|||
<c:forEach var="stat" items= "${stats}" varStatus="i"> |
|||
<c:if test="${stat.name == 'RK-P'}"> |
|||
<th >Difference</th> |
|||
<th id="diff" name="diff"><c:out value="--" /></th> |
|||
</c:if> |
|||
|
|||
<c:if test="${!stat.name.contains('/')}"> |
|||
<th id="diff" name="diff"><c:out value="--" /></th> |
|||
</c:if> |
|||
|
|||
</c:forEach> |
|||
</tr> |
|||
|
|||
</tbody> |
|||
|
|||
<thead > |
|||
<!----------------------------------------- STATS CAT ----------------> |
|||
<tr name="headers" class="Header" > |
|||
<th align="left" title="filter"><c:out value="Waiver" /></th> |
|||
<th name="cat" title="filter"><c:out value="Pot RK" /></th> |
|||
<c:forEach var="stat" items= "${stats}" > |
|||
<c:if test="${!fn:contains(stat.name,'/')}"> |
|||
<th name="cat" title="filter"><c:out value="${fn:replace(stat.name,'Team ','')}" /></th> |
|||
</c:if> |
|||
</c:forEach> |
|||
</tr> |
|||
</thead> |
|||
<!------------------------ START RESULT TAB--------------------------------> |
|||
|
|||
<tbody id="tTrade" style="overflow-y: scroll;overflow-x: hidden;" > |
|||
<c:forEach var="fa" items= "${mainFA}" > |
|||
|
|||
<tr name="lignesResults" class="tab" id="${i.index}" onclick="return listDiff(this);"> |
|||
|
|||
<c:forEach var="stat" items= "${fa}" varStatus="i" > |
|||
|
|||
<c:if test="${i.first}"> |
|||
<td align="left" name="get"><c:out value="${stat.player}" /></td> |
|||
<td name="tradeProjSel"><fmt:formatNumber pattern="0.#" value="${stat.projectedRK}" /></td> |
|||
</c:if> |
|||
<c:if test="${!fn:contains(stat.name,'/')}"> |
|||
<c:if test="${!fn:contains(stat.name,'%')}"> |
|||
<td name="tradeProjSel" align="center"><fmt:formatNumber pattern="0.#" value="${stat.valProjection}" /></td> |
|||
</c:if> |
|||
<c:if test="${fn:contains(stat.name,'%')}"> |
|||
<td name="tradeProjSel" align="center"><fmt:formatNumber pattern="0.00" value="${stat.valProjection}" /></td> |
|||
</c:if> |
|||
</c:if> |
|||
|
|||
</c:forEach> |
|||
|
|||
</tr> |
|||
|
|||
</c:forEach> |
|||
</tbody> |
|||
</table> |
|||
|
|||
|
|||
|
|||
</body> |
|||
</html> |
|||
|
|||
|
|||
@ -0,0 +1,92 @@ |
|||
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" |
|||
pageEncoding="ISO-8859-1"%> |
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
|||
<link href="${pageContext.request.contextPath}/CSS/style.css" rel="stylesheet" type="text/css" > |
|||
|
|||
<title>GRAPH</title> |
|||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> |
|||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> |
|||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> |
|||
<script type="text/javascript"> |
|||
|
|||
$(document).ready(function() { |
|||
|
|||
var title = '${title}'; |
|||
var maxVal = '${maxVal}'; |
|||
var lowVal = '${lowVal}'; |
|||
var width = '${width}'; |
|||
var height = '${height}'; |
|||
var left = '${left}'; |
|||
var top = '${top}'; |
|||
var divGraph = '${divGraph}'; |
|||
var legPos = '${legPos}'; |
|||
var direc = '${direc}'; |
|||
var heightPour = '${heightPour}'; |
|||
var widthPour = '${widthPour}'; |
|||
|
|||
|
|||
function drawLineColors() { |
|||
$.ajax({ |
|||
url: 'GRAPH_CALL', |
|||
dataType: 'json', |
|||
success: function (json) { |
|||
console.log(json); |
|||
// assumes json is a DataTable-compatible JSON string |
|||
var data = new google.visualization.DataTable(json); |
|||
|
|||
console.log(data); |
|||
var options = { |
|||
title: title, |
|||
titlePosition: {'position':'top','alignment':'center'}, |
|||
hAxis: { |
|||
//title: 'Season Days', |
|||
gridlines: {count: 0}, |
|||
}, |
|||
vAxis: { |
|||
//title: 'Relative Rotisserie Points', |
|||
direction: direc, |
|||
gridlines: {color: '#e3e3e2', count: 11}, |
|||
viewWindow: { |
|||
max: maxVal, |
|||
min: lowVal |
|||
} |
|||
}, |
|||
'width':width, |
|||
'height':height, |
|||
legend: {'position':legPos,'alignment':'center', textStyle: {fontSize: 10}}, |
|||
chartArea:{ |
|||
left:left,top:top,width:widthPour+"%",height:heightPour+"%", |
|||
/* backgroundColor: { |
|||
stroke: '#4322c0', |
|||
strokeWidth: 1 |
|||
} */ |
|||
}, |
|||
colors: ['#581845', '#FFC300', '#C70039','#d3fe04','#33ebff','#ff33ed','#0309af','#0aaf03','#fe0404','#bd5200','#037512','#acafad',] |
|||
}; |
|||
var chart = new google.visualization.LineChart(document.getElementById(divGraph)); |
|||
chart.draw(data, options); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
google.charts.load('current', {packages: ['corechart', 'line']}); |
|||
google.charts.setOnLoadCallback(drawLineColors); |
|||
|
|||
}); |
|||
|
|||
|
|||
</script> |
|||
|
|||
</head> |
|||
<body> |
|||
<c:set var="divGraphe" value="${divGraph}" /> |
|||
|
|||
<div style="text-align:center;" id="${divGraphe}"></div> |
|||
|
|||
</body> |
|||
</html> |
|||
|
|||
|
|||
@ -0,0 +1,182 @@ |
|||
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" |
|||
pageEncoding="ISO-8859-1"%> |
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
|||
<link href="${pageContext.request.contextPath}/CSS/style.css" rel="stylesheet" type="text/css" > |
|||
|
|||
<title>League Teams</title> |
|||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> |
|||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> |
|||
<script src="${pageContext.request.contextPath}/WEB-INF/lib/jquery.rowselector.min.js"></script> |
|||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> |
|||
<script type="text/javascript"> |
|||
|
|||
$(document).ready(function() { |
|||
$("#${tableName} > tbody > tr").each(function() { |
|||
if($(this).attr("teamid") != '${teamID}') |
|||
{ |
|||
this.className='hidden'; |
|||
} |
|||
}); |
|||
|
|||
}); |
|||
|
|||
$(window).load(function() { |
|||
|
|||
var cellP = $("td[name='player']"); |
|||
var nbPlayer = '${Tplayers.size()}'; |
|||
var tmp = generateColor('#ffd157','#ff0000',nbTeam/2); |
|||
var tmp2 = generateColor('#00d700','#d6fa05',nbTeam/2); |
|||
$.merge(tmp,tmp2); |
|||
var z = 0; |
|||
$(cellP).each(function() { |
|||
for(x=0;x<nbPlayer;x++){ |
|||
if($(cellP).eq(z).text() < nbTeam - x +0.5 && $(cellP).eq(z).text() >= nbTeam - x -0.5){ |
|||
$(this).css('background', 'linear-gradient(#'+tmp[x] + ', #' +tmp[x] + ')'); |
|||
} |
|||
} |
|||
z+=1; |
|||
}); |
|||
|
|||
function hex (c) { |
|||
var s = "0123456789abcdef"; |
|||
var i = parseInt (c); |
|||
if (i == 0 || isNaN (c)) |
|||
return "00"; |
|||
i = Math.round (Math.min (Math.max (0, i), 255)); |
|||
return s.charAt ((i - i % 16) / 16) + s.charAt (i % 16); |
|||
} |
|||
|
|||
/* Convert an RGB triplet to a hex string */ |
|||
function convertToHex (rgb) { |
|||
return hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]); |
|||
} |
|||
|
|||
/* Remove '#' in color hex string */ |
|||
function trim (s) { return (s.charAt(0) == '#') ? s.substring(1, 7) : s } |
|||
|
|||
/* Convert a hex string to an RGB triplet */ |
|||
function convertToRGB (hex) { |
|||
var color = []; |
|||
color[0] = parseInt ((trim(hex)).substring (0, 2), 16); |
|||
color[1] = parseInt ((trim(hex)).substring (2, 4), 16); |
|||
color[2] = parseInt ((trim(hex)).substring (4, 6), 16); |
|||
return color; |
|||
} |
|||
|
|||
function generateColor(colorStart,colorEnd,colorCount){ |
|||
// The beginning of your gradient |
|||
var start = convertToRGB (colorStart); |
|||
// The end of your gradient |
|||
var end = convertToRGB (colorEnd); |
|||
// The number of colors to compute |
|||
var len = colorCount; |
|||
//Alpha blending amount |
|||
var alpha = 0.0; |
|||
var saida = []; |
|||
for (i = 0; i < len; i++) { |
|||
var c = []; |
|||
alpha += (1.0/len); |
|||
|
|||
c[0] = start[0] * alpha + (1 - alpha) * end[0]; |
|||
c[1] = start[1] * alpha + (1 - alpha) * end[1]; |
|||
c[2] = start[2] * alpha + (1 - alpha) * end[2]; |
|||
|
|||
saida.push(convertToHex (c)); |
|||
} |
|||
return saida; |
|||
} |
|||
}); //end doc ready |
|||
|
|||
|
|||
function RowClick(currenttr,table, otherTable) { |
|||
|
|||
$("#" + table +" > tbody > tr").each(function() { |
|||
var tableRow = this; |
|||
|
|||
if($(tableRow).attr("id") == $(currenttr).attr("id")) |
|||
{ |
|||
|
|||
if($(tableRow).attr("teamid") != $(tableRow).attr("tid")){ |
|||
tableRow.className='hidden'; |
|||
$("#" + otherTable +" > tbody > tr").each(function() { |
|||
var otableRow = this; |
|||
if(otableRow.className=='selected' && $(tableRow).attr("player") == $(otableRow).attr("player")){ |
|||
otableRow.className ='tab'; |
|||
} |
|||
}); |
|||
|
|||
}else if(tableRow.className=='selected') |
|||
{ |
|||
tableRow.className='tab'; |
|||
$("#" + otherTable +" > tbody > tr").each(function() { |
|||
var otableRow = this; |
|||
if(otableRow.className=='displayed' && $(tableRow).attr("player") == $(otableRow).attr("player")){ |
|||
otableRow.className ='hidden'; |
|||
} |
|||
}); |
|||
}else |
|||
{ |
|||
tableRow.className='selected'; |
|||
$("#" + otherTable +" > tbody > tr").each(function() { |
|||
var otableRow = this; |
|||
if(otableRow.className=='hidden' && $(tableRow).attr("player") == $(otableRow).attr("player")){ |
|||
otableRow.className ='displayed'; |
|||
} |
|||
}); |
|||
} |
|||
} |
|||
}); |
|||
} |
|||
</script> |
|||
|
|||
</head> |
|||
<body> |
|||
|
|||
<c:set var="players" value="${requestScope.Tplayers}" /> |
|||
<c:set var="stats" value="${players[0].stats}" /> |
|||
|
|||
<table id="${tableName}" class="tableTrade" > |
|||
|
|||
<thead> |
|||
<tr class="Header"> |
|||
<th align="left"><c:out value="Pos" /></th> |
|||
<th align="left" style="width:120px"><c:out value="Players" /></th> |
|||
<th align="left"><c:out value="Team RK" /></th> |
|||
<c:forEach var="stat" items= "${stats}" varStatus="i"> |
|||
<th ><c:out value="${stat.name}" /></th> |
|||
</c:forEach> |
|||
</tr> |
|||
</thead> |
|||
|
|||
<tbody style="font-size:16px;font-weight: bold; "> |
|||
<c:forEach var="player" items= "${players}" varStatus="i"> |
|||
<tr style="height:20px;" class="tab" id="${i.index}" tid="${teamID}" teamid="${player.teamID}" player="${player.nom}" onclick="RowClick(this,'${tableName}','${otherTableName}');"> |
|||
|
|||
<c:set var="stats" value="${player.stats}" /> |
|||
|
|||
<td> |
|||
<c:forEach items="${player.positions}" var="position"> |
|||
<c:out value="${position}," /> |
|||
</c:forEach> |
|||
</td> |
|||
|
|||
<td style="width:120px;text-align:left;" ><c:out value="${player.nom}" /></td> |
|||
<td name="player" align="center"><fmt:formatNumber pattern="0.#" value="${player.interRK}" /></td> |
|||
|
|||
<c:forEach var="stat" items= "${stats}" varStatus="i"> |
|||
<td style="align:center"><c:out value="${stat.statVal}" /></td> |
|||
</c:forEach> |
|||
|
|||
</tr> |
|||
</c:forEach> |
|||
</tbody> |
|||
</table> |
|||
|
|||
|
|||
</body> |
|||
</html> |
|||
|
|||
|
|||
@ -0,0 +1,407 @@ |
|||
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" |
|||
pageEncoding="ISO-8859-1"%> |
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
|||
<link href="${pageContext.request.contextPath}/CSS/style.css" rel="stylesheet" type="text/css" > |
|||
|
|||
<title>team</title> |
|||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> |
|||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> |
|||
<%@ taglib uri = "http://java.sun.com/jsp/jstl/functions" prefix = "fn" %> |
|||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> |
|||
|
|||
<script> |
|||
|
|||
$(document).ready(function() { |
|||
|
|||
var ln = parseInt('${team1Stats.size()}'); |
|||
|
|||
//$(document).ready(function() { |
|||
var headers = $("[name='headers']"); |
|||
var lignesResults = $("[name='lignesResults']"); |
|||
|
|||
var nbTeam = $(headers).find("th").size() - ln *2 -12; |
|||
|
|||
|
|||
|
|||
// color impact in center columns |
|||
var impSel = $("[name='impSel']"); |
|||
for (x=0;x<$(impSel).size();x++){ |
|||
var n = ""+(parseFloat($(impSel).eq(x).text())); |
|||
if(n>0){ |
|||
$(impSel).eq(x).text("+" + n); |
|||
$(impSel).eq(x).removeClass("negative").addClass("positive"); |
|||
}else{ |
|||
$(impSel).eq(x).removeClass("positive").addClass("negative"); |
|||
} |
|||
} |
|||
|
|||
var entete = $("[name='headers']"); |
|||
//hide ft / fg stats |
|||
$(entete).find('th').each (function() { |
|||
if($(this).text().includes("/")){ |
|||
$(this).hide(); |
|||
} |
|||
}); |
|||
var entete2 = $("[name='headersTop']"); |
|||
//hide ft / fg stats |
|||
$(entete2).find('th').each (function() { |
|||
if($(this).text().includes("/")){ |
|||
$(this).hide(); |
|||
} |
|||
}); |
|||
var entete3 = $("[name='headersMid']"); |
|||
//hide ft / fg stats |
|||
$(entete3).find('th').each (function() { |
|||
if($(this).text().includes("/")){ |
|||
$(this).hide(); |
|||
} |
|||
}); |
|||
var tradeProjSel = $("td[name='tradeProjSel']"); |
|||
//hide ft / fg stats |
|||
$(tradeProjSel).each (function() { |
|||
if($(this).text().includes("/")){ |
|||
$(this).hide(); |
|||
} |
|||
}); |
|||
|
|||
//color other team points |
|||
var actualProj = $("[name='actualProj']"); |
|||
var cat = $("[name='cat']"); |
|||
var z = 0; |
|||
for (x=0;x<$(tradeProjSel).size();x++){ |
|||
if(z==$(cat).size()){z=0;} |
|||
if(z>$(cat).size()-nbTeam-1){ |
|||
var n = ""+(parseFloat($(tradeProjSel).eq(x).text()) - parseFloat($(actualProj).eq(z).text())); |
|||
if(n>0){ |
|||
$(tradeProjSel).eq(x).removeClass("negative").addClass("positive"); |
|||
}else{ |
|||
$(tradeProjSel).eq(x).removeClass("positive").addClass("negative"); |
|||
} |
|||
|
|||
} |
|||
z+=1; |
|||
} |
|||
|
|||
var sort = $("[name='sort']"); |
|||
$(sort).each(function(col) { |
|||
$(this).hover( |
|||
function() { $(this).addClass('focus'); }, |
|||
function() { $(this).removeClass('focus'); } |
|||
); |
|||
|
|||
if($(this).text()=="TOT RD"){ |
|||
$(this).addClass('desc selected'); |
|||
} |
|||
|
|||
$(this).click(function() { |
|||
if ($(this).is('.desc')) { |
|||
$(this).removeClass('desc'); |
|||
$(this).addClass('asc selected'); |
|||
sortOrder = 1; |
|||
} |
|||
else { |
|||
$(this).addClass('desc selected'); |
|||
$(this).removeClass('asc'); |
|||
sortOrder = -1; |
|||
} |
|||
$(this).siblings().removeClass('asc selected'); |
|||
$(this).siblings().removeClass('desc selected'); |
|||
|
|||
var arrData = $('table').find("tr[name='lignesResults']"); |
|||
/* var arrData = $('table').find('tbody:nth-of-type(2) > tr').get(); */ |
|||
|
|||
arrData.sort(function(a, b) { |
|||
var val1 = $(a).children('td').eq(col+${nbStats}+4).text().replace("+","").toUpperCase(); |
|||
var val2 = $(b).children('td').eq(col+${nbStats}+4).text().replace("+","").toUpperCase(); |
|||
if($.isNumeric(val1) && $.isNumeric(val2)) |
|||
return sortOrder == 1 ? val1-val2 : val2-val1; |
|||
else |
|||
return (val1 < val2) ? -sortOrder : (val1 > val2) ? sortOrder : 0; |
|||
}); |
|||
|
|||
|
|||
|
|||
$.each(arrData, function(index, row) { |
|||
$('tbody:nth-of-type(2)').append(row); |
|||
}); |
|||
}); |
|||
}); |
|||
|
|||
|
|||
$("#everything-wrapper").fadeIn(); |
|||
$('#loader').hide(); |
|||
}); |
|||
|
|||
function listDiff(Elem) |
|||
{ |
|||
|
|||
var impSel = $(Elem).find("td[name='impSel']"); |
|||
var imp = $("[name='imp']"); |
|||
var drop = $(Elem).find("td[name='drop']"); |
|||
var get = $(Elem).find("td[name='get']"); |
|||
var actualPlayers = $("[name='actualPlayers']"); |
|||
var tradePlayers = $("[name='tradePlayers']"); |
|||
var cat = $("[name='cat']"); |
|||
var actualProj = $("[name='actualProj']"); |
|||
var tradeProj = $("[name='tradeProj']"); |
|||
var diff = $("[name='diff']") |
|||
var tradeProjSel = $(Elem).find("td[name='tradeProjSel']"); |
|||
|
|||
$(actualPlayers).eq(0).text($(drop).eq(0).text()); |
|||
$(tradePlayers).eq(0).text($(get).eq(0).text()); |
|||
//$(actualPlayers).eq(1).text($(drop).eq(1).text()); |
|||
//$(tradePlayers).eq(1).text($(get).eq(1).text()); |
|||
|
|||
for (x=0;x<$(impSel).size();x++){ |
|||
$(imp).eq(x).text($(impSel).eq(x).text()); |
|||
var n = ""+(parseFloat($(imp).eq(x).text())); |
|||
if(n>0){ |
|||
$(imp).eq(x).removeClass("negative").addClass("positive"); |
|||
}else{ |
|||
$(imp).eq(x).removeClass("positive").addClass("negative"); |
|||
} |
|||
} |
|||
|
|||
for (x=0;x<$(cat).size();x++){ |
|||
|
|||
if($(cat).eq(x).text().includes('/')){ |
|||
var decomp = $(tradeProjSel).eq(x).text().split("/"); |
|||
var decomp2 = $(actualProj).eq(x).text().split("/"); |
|||
|
|||
$(tradeProj).eq(x).text(parseFloat(decomp[0]).toFixed(0) + "/" + parseFloat(decomp[1]).toFixed(0)); |
|||
|
|||
var valProj1 = parseFloat(decomp[0]) - parseFloat(decomp2[0]); |
|||
var valProj2 = parseFloat(decomp[1]) - parseFloat(decomp2[1]); |
|||
$(diff).eq(x).text(valProj1.toFixed(0) + "/" + valProj2.toFixed(0));//remaining points |
|||
}else if($(cat).eq(x).text().includes('%')){ |
|||
$(tradeProj).eq(x).text(parseFloat($(tradeProjSel).eq(x).text()).toFixed(2)); |
|||
var n = (parseFloat($(tradeProj).eq(x).text()) - parseFloat($(actualProj).eq(x).text())).toFixed(2); |
|||
if(n>0){ |
|||
$(diff).eq(x).text("+" + n); |
|||
$(diff).eq(x).removeClass("negative").addClass("positive"); |
|||
$(diff).eq(x+1).removeClass("negative").addClass("positive"); |
|||
}else{ |
|||
$(diff).eq(x).text(n); |
|||
$(diff).eq(x).removeClass("positive").addClass("negative"); |
|||
$(diff).eq(x+1).removeClass("positive").addClass("negative"); |
|||
} |
|||
}else if($(cat).eq(x).text() == 'TO'){ |
|||
$(tradeProj).eq(x).text(parseFloat($(tradeProjSel).eq(x).text())); |
|||
var n = ""+(parseFloat($(tradeProj).eq(x).text()) - parseFloat($(actualProj).eq(x).text())); |
|||
if(n>0){ |
|||
$(diff).eq(x).text("+" + n); |
|||
$(diff).eq(x).removeClass("positive").addClass("negative"); |
|||
}else{ |
|||
$(diff).eq(x).text(n); |
|||
$(diff).eq(x).removeClass("negative").addClass("positive"); |
|||
} |
|||
}else{ |
|||
$(tradeProj).eq(x).text(parseFloat($(tradeProjSel).eq(x).text())); |
|||
//inverse diff si col RK |
|||
if($(cat).eq(x).text() == 'RK'){ |
|||
var n = ""+(parseFloat($(actualProj).eq(x).text()) - parseFloat($(tradeProj).eq(x).text())); |
|||
if(n>0){ |
|||
$(diff).eq(x).text("+" + n); |
|||
$(diff).eq(x).removeClass("negative").addClass("positive"); |
|||
}else{ |
|||
$(diff).eq(x).text(n); |
|||
$(diff).eq(x).removeClass("positive").addClass("negative"); |
|||
} |
|||
}else{ |
|||
var n = parseFloat($(tradeProj).eq(x).text()) - parseFloat($(actualProj).eq(x).text()); |
|||
if(n>0){ |
|||
$(diff).eq(x).text("+" + n); |
|||
$(diff).eq(x).removeClass("negative").addClass("positive"); |
|||
}else{ |
|||
$(diff).eq(x).text(n); |
|||
$(diff).eq(x).removeClass("positive").addClass("negative"); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
|
|||
</script> |
|||
|
|||
</head> |
|||
<body onload=""> |
|||
|
|||
|
|||
<c:set var="mainTRADE" value="${requestScope.mainTRADE}" /> |
|||
<c:set var="stats" value="${requestScope.statBase}" /> |
|||
<c:set var="nbTeam" value="${requestScope.nbTeam}" /> |
|||
<c:set var="team1" value="${requestScope.team1}" /> |
|||
<c:set var="team1Stats" value="${requestScope.team1Stats}" /> |
|||
<c:set var="team2" value="${requestScope.team2}" /> |
|||
<c:set var="team2Stats" value="${requestScope.team2Stats}" /> |
|||
<c:set var="otherTeamStats" value="${requestScope.otherTeamStats}" /> |
|||
|
|||
<div id="everything-wrapper" > |
|||
|
|||
<table class="tableTrade" style="font-size: 7px;"> |
|||
|
|||
<thead "> |
|||
<!-- ajoute 3 titres de section ----- TEAM 2 -------------TEAM 2 --------OTHERS --> |
|||
<tr class="Header""> |
|||
<th name="tradeTab" rowspan="2" colspan="2"><c:out value="Traded players" /></th> |
|||
<th name="team1Tab" colspan="${(fn:length(stats)-nbTeam+2-6-2)/2 }"><c:out value="${team1.name}" /></th> |
|||
<th name="impTab" rowspan="2" colspan="6"><c:out value="Trade Impact" /></th> |
|||
<th name="team2Tab" colspan="${(fn:length(stats)-nbTeam+2-6-2)/2 }"><c:out value="${team2.name}" /></th> |
|||
<th name="impTeamTab" colspan="${nbTeam - 2}"><c:out value="Impact on other teams" /></th> |
|||
</tr> |
|||
|
|||
|
|||
<!-- STATS CAT --> |
|||
<tr name="headersTop" class="Header"> |
|||
<c:forEach var="stat" items= "${stats}" varStatus="i"> |
|||
<c:if test="${stat.name == 'RK-P'}"> |
|||
|
|||
<c:if test="${i.first}"> |
|||
|
|||
</c:if> |
|||
<th ><c:out value="RK" /></th> |
|||
</c:if> |
|||
<c:if test="${stat.name != 'IMP'}"> |
|||
<th><c:out value="${stat.name}" /></th> |
|||
</c:if> |
|||
</c:forEach> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<!-- LIGNE ACTUAL STATS PROJECTION--> |
|||
<tr name="headersTop" class="ligneHead" "> |
|||
<c:forEach var="stat" items= "${team1Stats}" varStatus="i"> |
|||
<c:if test="${i.first}"> |
|||
<th name="actualPlayers" rowspan="3">T1 trade</th> |
|||
<th name="tradePlayers" rowspan="3">T1 trade</th> |
|||
<th name="actualProj"><fmt:formatNumber pattern="0.#" value="${team1projectedRK}" /></th> |
|||
<th name="actualProj"><fmt:formatNumber pattern="0.#" value="${team1projTot}" /></th> |
|||
</c:if> |
|||
<th name="actualProj"><c:out value="${stat.valProjection}" /></th> |
|||
</c:forEach> |
|||
|
|||
<th colspan="6">ACTUAL PROJECTION</th> |
|||
|
|||
<c:forEach var="stat" items= "${team2Stats}" varStatus="i" > |
|||
<c:if test="${i.first}"> |
|||
<th name="actualProj"><fmt:formatNumber pattern="0.#" value="${team2projectedRK}" /></th> |
|||
<th name="actualProj"><fmt:formatNumber pattern="0.#" value="${team2projTot}" /></th> |
|||
</c:if> |
|||
<th name="actualProj"><c:out value="${stat.valProjection}" /></th> |
|||
</c:forEach> |
|||
|
|||
<c:forEach var="stat" items= "${otherTeamStats}" > |
|||
<th name="actualProj"><c:out value="${stat}" /></th> |
|||
</c:forEach> |
|||
</tr> |
|||
|
|||
<!-- LIGNE WITH TRADE STATS PROJECTION--> |
|||
<tr name="headersMid" class="ligneHead" "> |
|||
<c:forEach var="stat" items= "${stats}" varStatus="i"> |
|||
<c:if test="${i.first}"> |
|||
|
|||
</c:if> |
|||
<c:if test="${stat.name == 'RK-P'}"> |
|||
<th name="tradeProj"><c:out value="--" /></th> |
|||
</c:if> |
|||
<c:if test="${stat.name != 'IMP'}"> |
|||
<c:if test="${stat.name.contains('/')}"> |
|||
<th name="tradeProj"><c:out value="--/--" /></th> |
|||
</c:if> |
|||
<c:if test="${!stat.name.contains('/')}"> |
|||
<th name="tradeProj"><c:out value="--" /></th> |
|||
</c:if> |
|||
</c:if> |
|||
<c:if test="${stat.name == 'IMP'}"> |
|||
<th name="imp"><c:out value="<>" /></th> |
|||
</c:if> |
|||
|
|||
</c:forEach> |
|||
</tr> |
|||
<!------------- LIGNE DIFFERENCES -----> |
|||
<tr name="headersTop" class="ligneHead" "> |
|||
<c:forEach var="stat" items= "${stats}" varStatus="i"> |
|||
<c:if test="${stat.name == 'RK-P'}"> |
|||
<c:if test="${!i.first}"> |
|||
<th colspan="6">DIFFERENCES</th> |
|||
</c:if> |
|||
<c:if test="${i.first}"> |
|||
|
|||
</c:if> |
|||
<th id="diff" name="diff"><c:out value="--" /></th> |
|||
</c:if> |
|||
<c:if test="${stat.name != 'IMP'}"> |
|||
<c:if test="${stat.name.contains('/')}"> |
|||
<th id="diff" name="diff"><c:out value="--/--" /></th> |
|||
</c:if> |
|||
<c:if test="${!stat.name.contains('/')}"> |
|||
<th id="diff" name="diff"><c:out value="--" /></th> |
|||
</c:if> |
|||
</c:if> |
|||
</c:forEach> |
|||
</tr> |
|||
</tbody> |
|||
<thead> |
|||
<!------ DROP GET / REPEAT STATS CAT -----> |
|||
<tr name="headers" class="Header" "> |
|||
<c:forEach var="stat" items= "${stats}" varStatus="i"> |
|||
<c:if test="${stat.name == 'RK-P'}"> |
|||
<c:if test="${!i.first}"> |
|||
<th name="sort">RK D</th> |
|||
<th name="sort">PT D</th> |
|||
<th name="sort">TOT RD</th> |
|||
<th name="sort">TOT PD</th> |
|||
<th name="sort">RK D</th> |
|||
<th name="sort">PT D</th> |
|||
</c:if> |
|||
<c:if test="${i.first}"> |
|||
<th ><c:out value="${team1.name}" /></th> |
|||
<th ><c:out value="${team2.name}" /></th> |
|||
</c:if> |
|||
|
|||
<th name="cat"><c:out value="RK" /></th> |
|||
</c:if> |
|||
<c:if test="${stat.name != 'IMP'}"> |
|||
<th name="cat"><c:out value="${stat.name}" /></th> |
|||
</c:if> |
|||
</c:forEach> |
|||
</tr> |
|||
</thead> |
|||
<!------------------------ START RESULT TAB--------------------------------> |
|||
<tbody id="tTradediv" style=""> |
|||
<c:forEach var="trade" items= "${mainTRADE}" varStatus="j"> |
|||
|
|||
<tr name="lignesResults" class="tab" id="${i.index}" onclick="return listDiff(this);"> |
|||
<c:forEach var="stat" items= "${trade}" varStatus="i" > |
|||
<c:if test="${i.first}"> |
|||
<td name="drop"><c:out value="${stat.player}" /></td> |
|||
<td name="get"><c:out value="${stat.team}" /></td> |
|||
</c:if> |
|||
<c:if test="${stat.name == 'RK-P'}"> |
|||
<td name="tradeProjSel" align="center"><fmt:formatNumber pattern="0.#" value="${stat.projectedRK}" /></td> |
|||
</c:if> |
|||
<c:if test="${stat.name != 'IMP'}"> |
|||
<td name="tradeProjSel" align="center"><c:out value="${stat.valProjection}" /></td> |
|||
</c:if> |
|||
<c:if test="${stat.name == 'IMP'}"> |
|||
<td name="impSel" align="center"><c:out value="${stat.valProjection}" /></td> |
|||
</c:if> |
|||
|
|||
</c:forEach> |
|||
|
|||
</tr> |
|||
|
|||
</c:forEach> |
|||
</tbody> |
|||
|
|||
</table> |
|||
</div> |
|||
</body> |
|||
</html> |
|||
|
|||
|
|||
@ -0,0 +1,3 @@ |
|||
Manifest-Version: 1.0 |
|||
Class-Path: |
|||
|
|||
@ -0,0 +1,7 @@ |
|||
#Generated by Maven Integration for Eclipse |
|||
#Mon Oct 22 16:28:29 CEST 2018 |
|||
m2e.projectLocation=C\:\\Users\\lejay\\eclipse-workspace\\sd.zip_expanded\\FantasyManager |
|||
m2e.projectName=FantasyManager |
|||
groupId=FantasyManager |
|||
artifactId=FantasyManager |
|||
version=0.0.1-SNAPSHOT |
|||
@ -0,0 +1,81 @@ |
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|||
<modelVersion>4.0.0</modelVersion> |
|||
<groupId>FantasyManager</groupId> |
|||
<artifactId>FantasyManager</artifactId> |
|||
<version>0.0.1-SNAPSHOT</version> |
|||
<build> |
|||
<sourceDirectory>src</sourceDirectory> |
|||
<plugins> |
|||
<plugin> |
|||
<artifactId>maven-compiler-plugin</artifactId> |
|||
<version>3.7.0</version> |
|||
<configuration> |
|||
<source>1.8</source> |
|||
<target>1.8</target> |
|||
</configuration> |
|||
</plugin> |
|||
<plugin> |
|||
<artifactId>maven-war-plugin</artifactId> |
|||
<version>3.0.0</version> |
|||
<configuration> |
|||
<warSourceDirectory>WebContent</warSourceDirectory> |
|||
</configuration> |
|||
</plugin> |
|||
</plugins> |
|||
</build> |
|||
<dependencies> |
|||
<dependency> |
|||
<groupId>com.google.visualization</groupId> |
|||
<artifactId>visualization-datasource</artifactId> |
|||
<version>1.1.1</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.fasterxml.jackson.core</groupId> |
|||
<artifactId>jackson-core</artifactId> |
|||
<version>2.9.2</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>com.fasterxml.jackson.core</groupId> |
|||
<artifactId>jackson-annotations</artifactId> |
|||
<version>2.9.2</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>com.fasterxml.jackson.core</groupId> |
|||
<artifactId>jackson-databind</artifactId> |
|||
<version>2.9.2</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>org.jsoup</groupId> |
|||
<artifactId>jsoup</artifactId> |
|||
<version>1.9.1</version> |
|||
</dependency> |
|||
|
|||
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson --> |
|||
<dependency> |
|||
<groupId>com.google.code.gson</groupId> |
|||
<artifactId>gson</artifactId> |
|||
<version>2.3.1</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>mysql</groupId> |
|||
<artifactId>mysql-connector-java</artifactId> |
|||
<version>5.1.39</version> |
|||
</dependency> |
|||
<dependency> |
|||
<groupId>io.webfolder</groupId> |
|||
<artifactId>ui4j-webkit</artifactId> |
|||
<version>3.1.0</version> |
|||
</dependency> |
|||
|
|||
<dependency> |
|||
<groupId>org.seleniumhq.selenium</groupId> |
|||
<artifactId>selenium-firefox-driver</artifactId> |
|||
<version>3.13.0</version> |
|||
</dependency> |
|||
|
|||
|
|||
</dependencies> |
|||
<packaging>war</packaging> |
|||
</project> |
|||
@ -0,0 +1,352 @@ |
|||
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" |
|||
pageEncoding="ISO-8859-1"%> |
|||
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
|||
<link href="${pageContext.request.contextPath}/CSS/style.css" rel="stylesheet" type="text/css" > |
|||
<title>Insert title here</title> |
|||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> |
|||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> |
|||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> |
|||
<!--Load the AJAX API--> |
|||
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> |
|||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> |
|||
<script type="text/javascript"> |
|||
|
|||
$(document).ready(function() { |
|||
//-------------desactivate btn trade >>> need import players------------ |
|||
//document.getElementById("btnTrade").disabled = true; |
|||
var rows = $('table').find("tr[name='ligne']"); |
|||
var rowsInTable = $(rows).size(); |
|||
var height = 267 / rowsInTable; |
|||
$(rows).each(function() { |
|||
$(this).css("height", height); |
|||
}); |
|||
|
|||
var head = $("th[name='head']"); |
|||
var x= 0; |
|||
$(head).each(function() { |
|||
if(x==0){ |
|||
$(this).css("width", 110.6); |
|||
}else if(x==1 || x==3 || x==5 || x==7){ |
|||
$(this).css("width", 25); //140 |
|||
}else { |
|||
$(this).css("width", 45); //135 |
|||
} |
|||
|
|||
x+=1; |
|||
}); |
|||
|
|||
var stats = '${statsJson}'; |
|||
var json = JSON.parse(stats); |
|||
|
|||
drawMain(); |
|||
|
|||
function drawMain() { |
|||
$.ajax({ |
|||
url:'GRAPH_CALL', |
|||
type:'post', |
|||
data: {typeGraph: "mainGraph"}, |
|||
success:function(response) |
|||
{ |
|||
$("#cont_chart_div").html(response); |
|||
$('#loader').hide(); |
|||
//---------------------------------------change to load graphs |
|||
loader(); |
|||
|
|||
|
|||
} |
|||
}); |
|||
} |
|||
|
|||
function drawStat(x) { |
|||
$.ajax( |
|||
{ |
|||
url:'GRAPH_CALL', |
|||
type:'post', |
|||
data: {typeGraph: json[x]["name"]}, |
|||
success:function(response) |
|||
{ |
|||
$("#cont_"+json[x]["name"].replace("%","")).html(response); |
|||
|
|||
if(json[x]["name"] != "PTS"){ |
|||
if(json[x+1]["name"].includes("/")){ |
|||
drawStat(x+2); |
|||
}else{ |
|||
drawStat(x+1); |
|||
} |
|||
|
|||
}else{ |
|||
loader(); |
|||
} |
|||
$('#loader'+json[x]["name"].replace("%","")).hide(); |
|||
} |
|||
}); |
|||
} |
|||
|
|||
function loader() { |
|||
$.ajax({ |
|||
url:'LoadTester', |
|||
type:'get', |
|||
success:function(response) |
|||
{ |
|||
//$("#trade_div").html(response); |
|||
document.getElementById("btnTrade").disabled = false; |
|||
|
|||
//--------------BTN LIGNE LEAM---------------need import player stats |
|||
$(document).on("click","tr", function(e){ |
|||
document.getElementById($(this).index()).submit(); |
|||
}); |
|||
|
|||
drawStat(0); |
|||
|
|||
} |
|||
}); |
|||
} |
|||
|
|||
}); //end doc ready |
|||
|
|||
|
|||
$(window).load(function() { |
|||
|
|||
var totproj = $("[name='totproj']"); |
|||
var RKproj = $("[name='RKproj']"); |
|||
var RKteam = $("[name='RKteam']"); |
|||
var RKrel = $("[name='RKrel']"); |
|||
var tot = $("[name='tot']"); |
|||
var totRel = $("[name='totRel']"); |
|||
var nbTeam = '${teamList.size()}'; |
|||
var tmp = generateColor('#ffd157','#ff0000',nbTeam/2); |
|||
var tmp2 = generateColor('#00d700','#ffff00',nbTeam/2); |
|||
$.merge(tmp,tmp2); |
|||
var z = 0; |
|||
$(tot).each(function() { |
|||
for(x=0;x<nbTeam;x++){ |
|||
if($(RKteam).eq(z).text() < nbTeam - x +0.5 && $(RKteam).eq(z).text() >= nbTeam - x -0.5){ |
|||
$(this).css('background', 'linear-gradient(#'+tmp[x] + ', #' +tmp[x] + ')'); |
|||
$(this).css('text-shadow' , '0 1px 0 ##261300'); |
|||
} |
|||
} |
|||
z+=1; |
|||
}); |
|||
z = 0; |
|||
$(totRel).each(function() { |
|||
for(x=0;x<nbTeam;x++){ |
|||
if($(RKrel).eq(z).text() < nbTeam - x +0.5 && $(RKrel).eq(z).text() >= nbTeam - x -0.5){ |
|||
$(this).css('background', 'linear-gradient(#'+tmp[x] + ', #' +tmp[x] + ')' ); |
|||
$(this).css('text-shadow' , '0 1px 0 ##261300'); |
|||
} |
|||
} |
|||
z+=1; |
|||
}); |
|||
z = 0; |
|||
$(totproj).each(function() { |
|||
for(x=0;x<nbTeam;x++){ |
|||
if($(RKproj).eq(z).text() < nbTeam - x +0.5 && $(RKproj).eq(z).text() >= nbTeam - x -0.5){ |
|||
$(this).css('background', 'linear-gradient(#'+tmp[x] + ', #' +tmp[x] + ')'); |
|||
$(this).css('text-shadow' , '0 1px 0 ##261300'); |
|||
} |
|||
} |
|||
z+=1; |
|||
}); |
|||
|
|||
|
|||
function hex (c) { |
|||
var s = "0123456789abcdef"; |
|||
var i = parseInt (c); |
|||
if (i == 0 || isNaN (c)) |
|||
return "00"; |
|||
i = Math.round (Math.min (Math.max (0, i), 255)); |
|||
return s.charAt ((i - i % 16) / 16) + s.charAt (i % 16); |
|||
} |
|||
|
|||
/* Convert an RGB triplet to a hex string */ |
|||
function convertToHex (rgb) { |
|||
return hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]); |
|||
} |
|||
|
|||
/* Remove '#' in color hex string */ |
|||
function trim (s) { return (s.charAt(0) == '#') ? s.substring(1, 7) : s } |
|||
|
|||
/* Convert a hex string to an RGB triplet */ |
|||
function convertToRGB (hex) { |
|||
var color = []; |
|||
color[0] = parseInt ((trim(hex)).substring (0, 2), 16); |
|||
color[1] = parseInt ((trim(hex)).substring (2, 4), 16); |
|||
color[2] = parseInt ((trim(hex)).substring (4, 6), 16); |
|||
return color; |
|||
} |
|||
|
|||
function generateColor(colorStart,colorEnd,colorCount){ |
|||
// The beginning of your gradient |
|||
var start = convertToRGB (colorStart); |
|||
// The end of your gradient |
|||
var end = convertToRGB (colorEnd); |
|||
// The number of colors to compute |
|||
var len = colorCount; |
|||
//Alpha blending amount |
|||
var alpha = 0.0; |
|||
var saida = []; |
|||
for (i = 0; i < len; i++) { |
|||
var c = []; |
|||
alpha += (1.0/len); |
|||
|
|||
c[0] = start[0] * alpha + (1 - alpha) * end[0]; |
|||
c[1] = start[1] * alpha + (1 - alpha) * end[1]; |
|||
c[2] = start[2] * alpha + (1 - alpha) * end[2]; |
|||
|
|||
saida.push(convertToHex (c)); |
|||
} |
|||
return saida; |
|||
} |
|||
}); //end doc ready |
|||
|
|||
|
|||
function rebuildGraph() { |
|||
$.ajax({ |
|||
url:'CALL_Rebuild', |
|||
type:'post', |
|||
success:function(response) |
|||
{ |
|||
drawMain(); |
|||
} |
|||
}); |
|||
} |
|||
</script> |
|||
|
|||
|
|||
</head> |
|||
<body> |
|||
|
|||
|
|||
<c:set var="teams" value="${sessionScope.teamList}" /> |
|||
<c:set var="stats" value="${requestScope.statsBase}" /> |
|||
|
|||
|
|||
<div class="wrapper"> |
|||
<header class="main-head"> |
|||
<c:out value="${leagueName} League Teams - ${season} Rotisserie" /> |
|||
<div style="width: 100%;text-align: center;margin-bottom:10px;"> |
|||
<div style="display: inline-block;vertical-align:top;"> |
|||
<form name='TradeForm' method='post' action='tradeServlet'> |
|||
<input id='btnTrade' type='submit' value='Trade' /></form> |
|||
</div> |
|||
<div style="display: inline-block;vertical-align:top;"> |
|||
<input id="btnRebuild" type="button" value="Rebuild Graph" onclick="rebuildGraph();" /> |
|||
</div> |
|||
</div> |
|||
</header> |
|||
|
|||
<!-- <nav class="main-nav"> --> |
|||
<!-- <ul> --> |
|||
<!-- <li><a href="">Nav 1</a></li> --> |
|||
<!-- <li><a href="">Nav 2</a></li> --> |
|||
<!-- <li><a href="">Nav 3</a></li> --> |
|||
<!-- </ul> --> |
|||
<!-- </nav> --> |
|||
|
|||
<article class="graph"> |
|||
<ul class="listing"> |
|||
<li> |
|||
<table class="tableTrade"> |
|||
<thead> |
|||
<tr class="Header" style="line-height: 20px;"> |
|||
<th colspan="4">ESPN RANKING</th> |
|||
<th colspan="2">RELATIVE</th> |
|||
<th colspan="2">PROJECTION</th> |
|||
</tr> |
|||
<tr class="Header" style="line-height: 20px;"> |
|||
<th name="head" style="text-align:left">TEAM</th> |
|||
<th name="head">GP</th> |
|||
<th name="head" style="width: 49px;">ESPN PTS</th> |
|||
<th name="head">E-RK</th> |
|||
<th name="head" style="width: 49px;">REL PTS</th> |
|||
<th name="head">R-RK</th> |
|||
<th name="head" style="width: 49px;">PROJ PTS</th> |
|||
<th name="head">P-RK</th> |
|||
</tr> |
|||
<%-- <tr class="Header" ><th align="left"><c:out value="Team" /></th> |
|||
<c:forEach var="stat" items= "${stats}" > |
|||
<th><c:out value="${stat.name}" /></th> |
|||
</c:forEach> |
|||
<th><c:out value="ESPN Pts" /></th> |
|||
<th><c:out value="REL Pts" /></th> |
|||
</tr> --%> |
|||
</thead> |
|||
<tbody> |
|||
<c:forEach var="team" items= "${teams}" > |
|||
<tr name="ligne" class="tab"> |
|||
<td style="text-align:left;"><strong><c:out value="${team.name}" /></strong></td> |
|||
<%-- <c:forEach var="stat" items= "${team.stats}" > |
|||
<td align="center"><c:out value="${stat.valRot}" /></td> |
|||
</c:forEach> --%> |
|||
<td align="center"><c:out value="${team.gamesPlayed}" /></td> |
|||
<td name="tot" align="center"><fmt:formatNumber pattern="0.#" value="${team.totalrotPts}" /></td> |
|||
<td name="RKteam" align="center"><fmt:formatNumber pattern="0.#" value="${team.RK}" /></td> |
|||
<td name="totRel" align="center"><fmt:formatNumber pattern="0.#" value="${team.totalrotPtsRel}" /></td> |
|||
<td name="RKrel" align="center"><fmt:formatNumber pattern="0.#" value="${team.relativeRK}" /></td> |
|||
<td name="totproj" align="center"><fmt:formatNumber pattern="0.#" value="${team.projTot}" /></td> |
|||
<td name="RKproj" align="center"><fmt:formatNumber pattern="0.#" value="${team.projRK}" /></td> |
|||
<form id="${team.code}" action="teamServlet" method="post" > |
|||
<input type="submit" style="display:none;"/> |
|||
<input type="hidden" name="teamId" value="${team.code}"/> |
|||
</form> |
|||
</tr> |
|||
</c:forEach> |
|||
</tbody> |
|||
</table> |
|||
</li> |
|||
|
|||
<li class="wide"> |
|||
|
|||
<div class="HeaderDiv" style="line-height: 20px;text-align: center;"><c:out value="RANKING EVOLUTION RELATIVE TO GAMES PLAYED" /></div> |
|||
<div class="cn"> |
|||
<div id="cont_chart_div" style="height: 295px;"> |
|||
<div id="loader" style="width: 100%;text-align: center;display:block;vertical-align:center; margin-top: 135px"> |
|||
<span>Buildind RK Graph</span> |
|||
<span class="l-1"></span> |
|||
<span class="l-2"></span> |
|||
<span class="l-3"></span> |
|||
<span class="l-4"></span> |
|||
<span class="l-5"></span> |
|||
<span class="l-6"></span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</li> |
|||
|
|||
<c:forEach var="stat" items= "${stats}" varStatus="i"> |
|||
<c:if test="${!fn:contains(stat.name,'/')}"> |
|||
<li > |
|||
<div class="HeaderDiv" style="line-height: 20px;text-align: center;"><c:out value="${stat.name}" /></div> |
|||
|
|||
<div class="cn"> |
|||
|
|||
<div id="cont_${fn:replace(stat.name ,'%','')}" style="height: 200px;"> |
|||
<div id="loader${fn:replace(stat.name ,'%','')}" style="width: 100%;text-align: center; margin-top: 80px"> |
|||
<span><c:out value="Buildind ${stat.name} Graph" /></span> |
|||
<span class="l-1"></span> |
|||
<span class="l-2"></span> |
|||
<span class="l-3"></span> |
|||
<span class="l-4"></span> |
|||
<span class="l-5"></span> |
|||
<span class="l-6"></span> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</li> |
|||
</c:if> |
|||
</c:forEach> |
|||
</ul> |
|||
</article> |
|||
<!-- <footer class="main-footer">The footer</footer> --> |
|||
</div> |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,566 @@ |
|||
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" |
|||
pageEncoding="ISO-8859-1"%> |
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
|||
<link href="${pageContext.request.contextPath}/CSS/style.css" rel="stylesheet" type="text/css" > |
|||
|
|||
<title>team</title> |
|||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> |
|||
<%@ taglib uri = "http://java.sun.com/jsp/jstl/functions" prefix = "fn" %> |
|||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> |
|||
|
|||
|
|||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> |
|||
<script type="text/javascript"> |
|||
|
|||
|
|||
$(window).load(function() { |
|||
var ln = parseInt('${team1Stats.size()}'); |
|||
|
|||
//$(document).ready(function() { |
|||
|
|||
var lignesResults = $("[name='lignesResults']"); |
|||
var z = 0; |
|||
$(lignesResults).each (function() { |
|||
z = 0; |
|||
$(this).find("td").each(function() { |
|||
if(z==0){ |
|||
$(this).css("width", "95"); |
|||
}else if (+z <= ln ){ |
|||
$(this).css("width", "28"); |
|||
}else { |
|||
$(this).css("width", "48"); |
|||
} |
|||
z+=1; |
|||
}); |
|||
}); |
|||
var headers = $("[name='headers']"); |
|||
$(headers).each (function() { |
|||
z=0; |
|||
$(this).find("th").each(function() { |
|||
if(z==0){ |
|||
$(this).css("width", "95"); |
|||
}else if (+z <= ln ){ |
|||
$(this).css("width", "28"); |
|||
}else{ |
|||
$(this).css("width", "48"); |
|||
} |
|||
z+=1; |
|||
}); |
|||
}); |
|||
|
|||
var statTab = $("[name='statTab']"); |
|||
var teamTab = $("[name='teamTab']"); |
|||
|
|||
$(statTab).css("width", 95+6.8 + (ln) * (28+6.8) -6.8); |
|||
$(teamTab).css("width", (48+6.8) * (z-ln-1) -6.8); |
|||
|
|||
|
|||
//color other team points |
|||
var tradeProjSel = $("td[name='tradeProjSel']"); |
|||
var actualProj = $("[name='actualProj']"); |
|||
var cat = $("[name='cat']"); |
|||
z = 0; |
|||
for (x=0;x<$(tradeProjSel).size();x++){ |
|||
if(z==$(cat).size()){z=0;} |
|||
if($(cat).eq(z).text() == "RK-P"){ |
|||
var n = ""+(parseFloat($(tradeProjSel).eq(x).text()) - parseFloat($(actualProj).eq(z).text())); |
|||
if(n>0){ |
|||
$(tradeProjSel).eq(x).addClass("positive"); |
|||
$(tradeProjSel).eq(x-1).addClass("positive"); |
|||
}else if(n==0){ |
|||
$(tradeProjSel).eq(x).addClass("neutral"); |
|||
$(tradeProjSel).eq(x-1).addClass("neutral"); |
|||
}else{ |
|||
$(tradeProjSel).eq(x).addClass("negative"); |
|||
$(tradeProjSel).eq(x-1).addClass("negative"); |
|||
} |
|||
} |
|||
if(z >= ln){ |
|||
var n = ""+(parseFloat($(tradeProjSel).eq(x).text()) - parseFloat($(actualProj).eq(z).text())); |
|||
if(n>0){ |
|||
$(tradeProjSel).eq(x).addClass("positive"); |
|||
}else if(n==0){ |
|||
$(tradeProjSel).eq(x).addClass("neutral"); |
|||
}else{ |
|||
$(tradeProjSel).eq(x).addClass("negative"); |
|||
} |
|||
} |
|||
z+=1; |
|||
} |
|||
|
|||
var actual = $(actualProj).eq(1).text(); |
|||
var potPTScell = $("[name='potPTScell']"); |
|||
var potRKcell = $("[name='potRKcell']"); |
|||
z = 0; |
|||
$(potPTScell).each (function() { |
|||
var n = ""+(parseFloat($(this).text()) - parseFloat(actual)); |
|||
if(n>0){ |
|||
$(this).addClass("positive"); |
|||
$(potRKcell).eq(z).addClass("positive"); |
|||
}else if(n==0){ |
|||
$(this).addClass("neutral"); |
|||
$(potRKcell).eq(z).addClass("neutral"); |
|||
}else{ |
|||
$(this).addClass("negative"); |
|||
$(potRKcell).eq(z).addClass("negative") |
|||
} |
|||
z+=1; |
|||
}); |
|||
|
|||
//var player = $("[name='player']"); |
|||
//callfilterResults($(player).eq(0).text()); |
|||
|
|||
// var potRK = '${potRKJson}'; |
|||
// var potRKJson = JSON.parse(potRK); |
|||
// var potRKcell = $("[name='potRKcell']"); |
|||
// x=0; |
|||
// $(potRKcell).each(function(col) { |
|||
// $(this).text(potRKJson[x]); |
|||
// x+=1; |
|||
// }); |
|||
|
|||
// var potPts = '${potPtsJson}'; |
|||
// var potPtsJson = JSON.parse(potPts); |
|||
// var potPTScell = $("[name='potPTScell']"); |
|||
// var x=0; |
|||
// $(potPTScell).each(function(col) { |
|||
// $(this).text(potPtsJson[x]); |
|||
// x+=1; |
|||
// }); |
|||
/* var actualProj = $("[name='actualProj']"); |
|||
var actual = $(actualProj).eq(1).text(); |
|||
// Declare variables |
|||
var input, filter, table, tr, td,td2, i; |
|||
|
|||
table = document.getElementById("tableList"); |
|||
tr = $("[name='lignesPlayer']"); |
|||
// Loop through all table rows, and hide those who don't match the search query |
|||
for (i = 0; i < tr.length; i++) { |
|||
td = tr[i].getElementsByTagName("td")[3]; |
|||
if (td) { |
|||
if (td.innerHTML > actual) { |
|||
tr[i].classList.remove('normal'); |
|||
tr[i].classList.add("freeAgentGreen"); |
|||
} else if (td.innerHTML == actual) { |
|||
tr[i].classList.remove('normal'); |
|||
tr[i].classList.add("freeAgentOrange"); |
|||
} else if (td.innerHTML < actual) { |
|||
tr[i].classList.remove('normal'); |
|||
tr[i].classList.add("freeAgentRed"); |
|||
} |
|||
} |
|||
} |
|||
|
|||
table = document.getElementById("tTrade"); |
|||
tr = $("[name='lignesResults']"); |
|||
// Loop through all table rows, and hide those who don't match the search query |
|||
for (i = 0; i < tr.length; i++) { |
|||
td = tr[i].getElementsByTagName("td")[3]; |
|||
td2 = tr[i].getElementsByTagName("td")[0]; |
|||
if (td) { |
|||
if (td2.innerHTML.indexOf("*") > -1) { |
|||
tr[i].classList.remove('tab'); |
|||
tr[i].classList.add("freeAgentInjured"); |
|||
} else if (td.innerHTML > actual) { |
|||
tr[i].classList.remove('tab'); |
|||
tr[i].classList.add("freeAgentGreen"); |
|||
} else if (td.innerHTML == actual) { |
|||
tr[i].classList.remove('tab'); |
|||
tr[i].classList.add("freeAgentOrange"); |
|||
} else if (td.innerHTML < actual) { |
|||
tr[i].classList.remove('tab'); |
|||
tr[i].classList.add("freeAgentRed"); |
|||
} |
|||
} |
|||
} */ |
|||
|
|||
|
|||
|
|||
|
|||
|
|||
var sort = $("[title='filter']"); |
|||
$(sort).each(function(col) { |
|||
$(this).hover( |
|||
function() { $(this).addClass('focus'); }, |
|||
function() { $(this).removeClass('focus'); } |
|||
); |
|||
|
|||
if($(this).text()=="RK-P"){ |
|||
$(this).addClass('desc selected'); |
|||
}; |
|||
|
|||
$(this).click(function() { |
|||
if ($(this).is('.desc')) { |
|||
$(this).removeClass('desc'); |
|||
$(this).addClass('asc selected'); |
|||
sortOrder = 1; |
|||
} |
|||
else { |
|||
$(this).addClass('desc selected'); |
|||
$(this).removeClass('asc'); |
|||
sortOrder = -1; |
|||
} |
|||
$(this).siblings().removeClass('asc selected'); |
|||
$(this).siblings().removeClass('desc selected'); |
|||
|
|||
var arrData = $('table').find("tr[name='lignesResults']"); |
|||
/* var arrData = $('table').find('tbody:nth-of-type(2) > tr').get(); */ |
|||
|
|||
arrData.sort(function(a, b) { |
|||
var val1 = $(a).children('td').eq(col).text().replace("+","").toUpperCase(); |
|||
var val2 = $(b).children('td').eq(col).text().replace("+","").toUpperCase(); |
|||
if($.isNumeric(val1) && $.isNumeric(val2)) |
|||
return sortOrder == 1 ? val1-val2 : val2-val1; |
|||
else |
|||
return (val1 < val2) ? -sortOrder : (val1 > val2) ? sortOrder : 0; |
|||
}); |
|||
|
|||
|
|||
$.each(arrData, function(index, row) { |
|||
$('tbody:nth-of-type(3)').append(row); |
|||
}); |
|||
}); |
|||
}); |
|||
|
|||
$("#everything-wrapper").fadeIn("fast"); |
|||
}); |
|||
//}); |
|||
|
|||
|
|||
|
|||
function filterName(){ |
|||
// Declare variables |
|||
var input, filter, table, tr, td, i; |
|||
input = document.getElementById("myInput"); |
|||
filter = input.value.toUpperCase(); |
|||
table = document.getElementById("tTrade"); |
|||
tr = $("[name='lignesResults']"); |
|||
|
|||
// Loop through all table rows, and hide those who don't match the search query |
|||
for (i = 0; i < tr.length; i++) { |
|||
td = tr[i].getElementsByTagName("td")[0]; |
|||
if (td) { |
|||
if (td.innerHTML.toUpperCase().indexOf(filter) > -1) { |
|||
tr[i].style.display = ""; |
|||
} else { |
|||
tr[i].style.display = "none"; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
function filterResults(Search) |
|||
{ |
|||
// Declare variables |
|||
var input, filter, table, tr, td, i; |
|||
table = document.getElementById("tTrade"); |
|||
tr = $("[name='lignesResults']"); |
|||
|
|||
// Loop through all table rows, and hide those who don't match the search query |
|||
for (i = 0; i < tr.length; i++) { |
|||
td = tr[i].getElementsByTagName("td")[0]; |
|||
if (td) { |
|||
if (td.innerHTML.toUpperCase().indexOf(Search) > -1) { |
|||
tr[i].style.display = ""; |
|||
} else { |
|||
tr[i].style.display = "none"; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
function callfilterResults(Elem) { |
|||
|
|||
var player = $("[name='player']"); |
|||
|
|||
$.ajax( |
|||
{ |
|||
url:'teamServlet', |
|||
type:'post', |
|||
data: {teamId:'${team1.code}', playerId: $(Elem).index() , action: 'faDiv'}, |
|||
success:function(response) |
|||
{ |
|||
$("#fa_div").html(response); |
|||
} |
|||
}); |
|||
|
|||
} |
|||
|
|||
|
|||
function listDiff(Elem) |
|||
{ |
|||
var drop = '${player.nom}'; |
|||
var get = $(Elem).find("td[name='get']"); |
|||
var actualPlayers = $("[name='actualPlayers']"); |
|||
var tradePlayers = $("[name='tradePlayers']"); |
|||
var cat = $("[name='cat']"); |
|||
var actualProj = $("[name='actualProj']"); |
|||
var tradeProj = $("[name='tradeProj']"); |
|||
var diff = $("[name='diff']") |
|||
var tradeProjSel = $(Elem).find("td[name='tradeProjSel']"); |
|||
|
|||
$(actualPlayers).eq(0).text(drop); |
|||
$(tradePlayers).eq(0).text($(get).eq(0).text()); |
|||
|
|||
for (x=0;x<$(cat).size();x++){ |
|||
|
|||
if($(cat).eq(x).text().includes('/')){ |
|||
var decomp = $(tradeProjSel).eq(x).text().split("/"); |
|||
var decomp2 = $(actualProj).eq(x).text().split("/"); |
|||
$(tradeProj).eq(x).text(parseFloat(decomp[0]).toFixed(0) + "/" + parseFloat(decomp[1]).toFixed(0)); |
|||
var valProj1 = parseFloat(decomp[0]) - parseFloat(decomp2[0]); |
|||
var valProj2 = parseFloat(decomp[1]) - parseFloat(decomp2[1]); |
|||
$(diff).eq(x).text(valProj1.toFixed(0) + "/" + valProj2.toFixed(0));//remaining points |
|||
}else if($(cat).eq(x).text().includes('%')){ |
|||
$(tradeProj).eq(x).text(parseFloat($(tradeProjSel).eq(x).text()).toFixed(2)); |
|||
var n = (parseFloat($(tradeProj).eq(x).text()) - parseFloat($(actualProj).eq(x).text())).toFixed(2); |
|||
changeStyle(diff,n); |
|||
}else if($(cat).eq(x).text().includes('TO')){ |
|||
$(tradeProj).eq(x).text(parseFloat($(tradeProjSel).eq(x).text())); |
|||
var n = ""+(parseFloat($(actualProj).eq(x).text()) - parseFloat($(tradeProj).eq(x).text())); |
|||
if(n>0){ |
|||
$(diff).eq(x).text(n); |
|||
$(diff).eq(x).removeClass("positive neutral").addClass("negative"); |
|||
}else if(n==0){ |
|||
$(diff).eq(x).text(n); |
|||
$(diff).eq(x).removeClass("positive negative").addClass("neutral"); |
|||
}else{ |
|||
$(diff).eq(x).text(n); |
|||
$(diff).eq(x).removeClass("negative neutral").addClass("positive"); |
|||
} |
|||
}else{ |
|||
$(tradeProj).eq(x).text(parseFloat($(tradeProjSel).eq(x).text())); |
|||
//inverse diff si col RK |
|||
if($(cat).eq(x).text() == 'Pot RK'){ |
|||
var n = ""+(parseFloat($(actualProj).eq(x).text()) - parseFloat($(tradeProj).eq(x).text())); |
|||
changeStyle(diff,n); |
|||
}else{ |
|||
var n = parseFloat($(tradeProj).eq(x).text()) - parseFloat($(actualProj).eq(x).text()); |
|||
changeStyle(diff,n); |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|||
} |
|||
|
|||
function changeStyle(diff,n) |
|||
{ |
|||
if(n>0){ |
|||
$(diff).eq(x).text("+" + n); |
|||
$(diff).eq(x).removeClass("negative neutral").addClass("positive"); |
|||
}else if(n==0){ |
|||
$(diff).eq(x).text(n); |
|||
$(diff).eq(x).removeClass("positive negative").addClass("neutral"); |
|||
}else{ |
|||
$(diff).eq(x).text(n); |
|||
$(diff).eq(x).removeClass("positive neutral").addClass("negative"); |
|||
} |
|||
} |
|||
|
|||
function makeTableScroll() { |
|||
|
|||
var maxRows = 25; |
|||
var tablebody = document.getElementById('tTrade'); |
|||
var rowsInTable = tablebody.rows.length; |
|||
var height = 0; |
|||
if (rowsInTable > maxRows) { |
|||
for (var i = 0; i < maxRows; i++) { |
|||
height += tablebody.rows[i].clientHeight; |
|||
} |
|||
tablebody.style.height = height + "px"; |
|||
} |
|||
|
|||
|
|||
|
|||
|
|||
} |
|||
|
|||
</script> |
|||
|
|||
</head> |
|||
<body onload="makeTableScroll()"> |
|||
|
|||
<c:set var="players" value="${requestScope.playerList}" /> |
|||
<c:set var="teamID" value="${requestScope.teamID}" /> |
|||
|
|||
<c:set var="mainFA" value="${requestScope.mainFA}" /> |
|||
<c:set var="stats" value="${requestScope.statBase}" /> |
|||
<c:set var="team1" value="${requestScope.team1}" /> |
|||
<c:set var="team1Stats" value="${requestScope.team1Stats}" /> |
|||
<c:set var="otherTeamStats" value="${requestScope.otherTeamStats}" /> |
|||
<c:set var="nbTeam" value="${requestScope.nbTeam}" /> |
|||
|
|||
<h1 align='center'>Find Free Agents</h1> |
|||
|
|||
<!-- <div style="width: 100%;text-align: center;"> |
|||
<input type="submit" value="test fa" onclick="listFA();"/> |
|||
</div> --> |
|||
|
|||
|
|||
<div id="everything-wrapper" style="width: 100%;text-align: center;"> |
|||
|
|||
<div style="display: inline-block;vertical-align:top;width:275px;" > |
|||
|
|||
<table class="tableTrade"> |
|||
<thead> |
|||
<tr class="Header"> |
|||
<th colspan="2" ><c:out value="TEAM" /></th> |
|||
<th name="actualRK"><c:out value="Proj RK" /></th> |
|||
<th name="actualPTS"><c:out value="Proj PTS" /></th> |
|||
</tr> |
|||
</thead> |
|||
<tr class="ligneHead"> |
|||
<th colspan="2"><c:out value="${team1.name}" /></th> |
|||
<th name="actualRK"><fmt:formatNumber pattern="0.#" value="${team1.projRK}" /></th> |
|||
<th name="actualPTS"><fmt:formatNumber pattern="0.#" value="${team1.projTot}" /></th> |
|||
</tr> |
|||
|
|||
<thead> |
|||
<tr class="Header"> |
|||
<th><c:out value="Player RK" /></th> |
|||
<th align="left"><c:out value="Player" /></th> |
|||
<th ><c:out value="Pot RK" /></th> |
|||
<th ><c:out value="Pot PTS" /></th> |
|||
</tr> |
|||
|
|||
</thead> |
|||
<tbody > |
|||
<c:forEach var="player" items= "${players}" varStatus="i"> |
|||
<tr name="lignesPlayer" class="tab" id="${i.index}" onclick="return callfilterResults(this);"> |
|||
<td align="center"><fmt:formatNumber pattern="0.#" value="${player.interRK}" /></td> |
|||
<td align="left" name ="player"><c:out value="${player.nom}" /></td> |
|||
<td name="potRKcell" ><fmt:formatNumber pattern="0.#" value="${player.potRK}" /></td> |
|||
<td name="potPTScell" ><fmt:formatNumber pattern="0.#" value="${player.potPoint}" /></td> |
|||
</tr> |
|||
</c:forEach> |
|||
</tbody> |
|||
</table> |
|||
|
|||
<input type="text" id="myInput" onkeyup="filterName()" placeholder="Search for names.."> |
|||
|
|||
</div> |
|||
|
|||
<div id="fa_div" style="display: inline-block;vertical-align:top"> |
|||
|
|||
<table class="tableTrade"> |
|||
<thead > |
|||
<!---------------------- TAB HEADER-------------------------------> |
|||
<tr class="Header" > |
|||
<th name="statTab" colspan="${fn:length(team1Stats)+1}"><c:out value="Waiver impact" /></th> |
|||
<th name="teamTab" colspan="${nbTeam - 1}"><c:out value="Impact on other teams" /></th> |
|||
</tr> |
|||
<!----------------------------------------- STATS CAT ----------------> |
|||
<tr name="headers" class="Header" > |
|||
<th align="left" ><c:out value="Drop" /></th> |
|||
<th ><c:out value="Pot RK" /></th> |
|||
<c:forEach var="stat" items= "${stats}" > |
|||
<c:if test="${!fn:contains(stat.name,'/')}"> |
|||
<th ><c:out value="${fn:replace(stat.name,'Team ','')}" /></th> |
|||
</c:if> |
|||
</c:forEach> |
|||
</tr> |
|||
</thead> |
|||
<!------------------------------- LIGNE ACTUAL STATS PROJECTION--> |
|||
<tbody > |
|||
<tr name="headers" class="ligneHead" > |
|||
<c:forEach var="stat" items= "${team1Stats}" varStatus="i"> |
|||
<c:if test="${i.first}"> |
|||
<th name="actualPlayers">Actual Projection</th> |
|||
<th name="actualProj"><fmt:formatNumber pattern="0.#" value="${team1projectedRK}" /></th> |
|||
<th name="actualProj"><fmt:formatNumber pattern="0.#" value="${team1projTot}" /></th> |
|||
</c:if> |
|||
<c:if test="${!fn:contains(stat.name,'/')}"> |
|||
<th name="actualProj"><c:out value="${stat.valProjection}" /></th> |
|||
</c:if> |
|||
</c:forEach> |
|||
|
|||
<c:forEach var="stat" items= "${otherTeamStats}" > |
|||
<th name="actualProj"><c:out value="${stat}" /></th> |
|||
</c:forEach> |
|||
</tr> |
|||
|
|||
<!-- LIGNE WITH FA STATS PROJECTION--> |
|||
<tr name="headers" class="ligneHead" > |
|||
<c:forEach var="stat" items= "${stats}" varStatus="i"> |
|||
<c:if test="${stat.name == 'RK-P'}"> |
|||
<th name="tradePlayers" >Proj with FA</th> |
|||
<th name="tradeProj"><c:out value="--" /></th> |
|||
</c:if> |
|||
|
|||
<c:if test="${!stat.name.contains('/')}"> |
|||
<th name="tradeProj"><c:out value="--" /></th> |
|||
</c:if> |
|||
|
|||
</c:forEach> |
|||
</tr> |
|||
|
|||
<!------------- LIGNE DIFFERENCES -----> |
|||
<tr name="headers" class="ligneHead" > |
|||
<c:forEach var="stat" items= "${stats}" varStatus="i"> |
|||
<c:if test="${stat.name == 'RK-P'}"> |
|||
<th >Difference</th> |
|||
<th id="diff" name="diff"><c:out value="--" /></th> |
|||
</c:if> |
|||
|
|||
<c:if test="${!stat.name.contains('/')}"> |
|||
<th id="diff" name="diff"><c:out value="--" /></th> |
|||
</c:if> |
|||
|
|||
</c:forEach> |
|||
</tr> |
|||
|
|||
</tbody> |
|||
|
|||
<thead > |
|||
<!----------------------------------------- STATS CAT ----------------> |
|||
<tr name="headers" class="Header" > |
|||
<th align="left" title="filter"><c:out value="Waiver" /></th> |
|||
<th name="cat" title="filter"><c:out value="Pot RK" /></th> |
|||
<c:forEach var="stat" items= "${stats}" > |
|||
<c:if test="${!fn:contains(stat.name,'/')}"> |
|||
<th name="cat" title="filter"><c:out value="${fn:replace(stat.name,'Team ','')}" /></th> |
|||
</c:if> |
|||
</c:forEach> |
|||
</tr> |
|||
</thead> |
|||
<!------------------------ START RESULT TAB--------------------------------> |
|||
|
|||
<tbody id="tTrade" style="overflow-y: scroll;overflow-x: hidden;" > |
|||
<c:forEach var="fa" items= "${mainFA}" > |
|||
|
|||
<tr name="lignesResults" class="tab" id="${i.index}" onclick="return listDiff(this);"> |
|||
|
|||
<c:forEach var="stat" items= "${fa}" varStatus="i" > |
|||
|
|||
<c:if test="${i.first}"> |
|||
<td align="left" name="get"><c:out value="${stat.player}" /></td> |
|||
<td name="tradeProjSel"><fmt:formatNumber pattern="0.#" value="${stat.projectedRK}" /></td> |
|||
</c:if> |
|||
<c:if test="${!fn:contains(stat.name,'/')}"> |
|||
<c:if test="${!fn:contains(stat.name,'%')}"> |
|||
<td name="tradeProjSel" align="center"><fmt:formatNumber pattern="0.#" value="${stat.valProjection}" /></td> |
|||
</c:if> |
|||
<c:if test="${fn:contains(stat.name,'%')}"> |
|||
<td name="tradeProjSel" align="center"><fmt:formatNumber pattern="0.00" value="${stat.valProjection}" /></td> |
|||
</c:if> |
|||
</c:if> |
|||
|
|||
</c:forEach> |
|||
|
|||
</tr> |
|||
|
|||
</c:forEach> |
|||
</tbody> |
|||
</table> |
|||
|
|||
</div> |
|||
</div> |
|||
|
|||
</body> |
|||
</html> |
|||
|
|||
|
|||
|
|||
@ -0,0 +1,185 @@ |
|||
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" |
|||
pageEncoding="ISO-8859-1"%> |
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
|||
<html> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
|||
<link href="${pageContext.request.contextPath}/CSS/style.css" rel="stylesheet" type="text/css" > |
|||
|
|||
<title>trade</title> |
|||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> |
|||
|
|||
|
|||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> |
|||
<script type="text/javascript"> |
|||
|
|||
$(document).ready(function() { |
|||
$('#drop1').val(6); |
|||
listTeam('drop1','team1_div','team2_div',true) |
|||
|
|||
|
|||
|
|||
}); //end doc ready |
|||
|
|||
|
|||
function listTeam(Elem, Div, otherDiv, first) |
|||
{ |
|||
var selT = document.getElementsByName(Elem)[0].value; |
|||
|
|||
if (Elem == 'drop1'){ |
|||
//desactive l entree dans la liste 2 |
|||
$("#drop2 > option").each(function() { |
|||
this.removeAttribute("disabled"); |
|||
if(this.value == selT){ |
|||
this.setAttribute("disabled", "disabled"); |
|||
} |
|||
}); |
|||
var othT = $('#drop2 option:selected').val(); |
|||
}else{ |
|||
//desactive l entree dans la liste 1 |
|||
$("#drop1 > option").each(function() { |
|||
this.removeAttribute("disabled"); |
|||
if(this.value == selT){ |
|||
this.setAttribute("disabled", "disabled"); |
|||
} |
|||
}); |
|||
var othT = $('#drop1 option:selected').val(); |
|||
} |
|||
|
|||
$.ajax( |
|||
{ |
|||
url:'CALL_DIV_team', |
|||
type:'get', |
|||
data: {selectedT: selT, otherT: othT, tableName: Div, otherTableName: otherDiv}, |
|||
success:function(response) |
|||
{ |
|||
$("#"+Div).html(response); |
|||
} |
|||
}); |
|||
|
|||
if(Elem == 'drop2' && first){ |
|||
listTeam('drop1','team1_div','team2_div',false) |
|||
} |
|||
else if(Elem == 'drop1' && first){ |
|||
listTeam('drop2','team2_div','team1_div',false) |
|||
} |
|||
|
|||
} |
|||
|
|||
function listTrade() |
|||
{ |
|||
|
|||
//$("#divTeams").fadeOut(); |
|||
$("#divTrade").fadeIn(); |
|||
|
|||
//$("#btnList").fadeOut(); |
|||
|
|||
|
|||
var T1 = document.getElementById('drop1').value; |
|||
var T2 = document.getElementById('drop2').value; |
|||
|
|||
stringSelT1 = ""; |
|||
$("#team1_div tr.selected").each(function() { |
|||
stringSelT1 += $(this).attr("player") +","; |
|||
}); |
|||
stringSelT2 = ""; |
|||
$("#team2_div tr.selected").each(function() { |
|||
stringSelT2 += $(this).attr("player") +","; |
|||
}); |
|||
|
|||
$.ajax( |
|||
{ |
|||
url:'DIV_trade', |
|||
type:'get', |
|||
data: {team1: T1 , team2: T2 , selTeam1: stringSelT1 , selTeam2: stringSelT2}, |
|||
success:function(response) |
|||
{ |
|||
$("#trade_div").html(response); |
|||
//$("#btnTrade").fadeIn(); |
|||
} |
|||
}); |
|||
|
|||
|
|||
} |
|||
function chooseTrade() |
|||
{ |
|||
//$("#divTeams").fadeIn(); |
|||
//$("#btnList").fadeIn(); |
|||
//$("#divTrade").fadeOut(); |
|||
//$("#btnTrade").fadeOut(); |
|||
} |
|||
</script> |
|||
|
|||
</head> |
|||
<body> |
|||
|
|||
<c:set var="teams" value="${requestScope.teamList}" /> |
|||
|
|||
<div class="wrapper"> |
|||
<header class="main-head"> |
|||
<c:out value="Trade Analyser" /> |
|||
<div style="width: 100%;text-align: center;margin-bottom:10px;"> |
|||
<div id="btnList" style="display: inline-block;vertical-align:top;"> |
|||
<input type="submit" value="Test trade" onclick="listTrade();"/> |
|||
</div> |
|||
<div id="btnTrade" style="display: inline-block;vertical-align:top;display: none;"> |
|||
<input type="submit" value="Select Trade" onclick="chooseTrade();"/> |
|||
</div> |
|||
</div> |
|||
</header> |
|||
|
|||
<!-- <nav class="main-nav"> |
|||
<ul> |
|||
<li><a href="">Nav 1</a></li> |
|||
<li><a href="">Nav 2</a></li> |
|||
<li><a href="">Nav 3</a></li> |
|||
</ul> |
|||
</nav> |
|||
--> |
|||
|
|||
<article class="team"> |
|||
<ul class="listingTeam"> |
|||
<li id="divTeams1"> |
|||
<Select id="drop1" name="drop1" onchange="return listTeam('drop1','team1_div','team2_div',true);"> |
|||
<c:forEach var="team" items= "${teams}" varStatus="i"> |
|||
<Option value="${i.index}">${team.name}</ Option> |
|||
</c:forEach> |
|||
</select> |
|||
<div id="team1_div"></div> |
|||
</li> |
|||
|
|||
<li id="divTeams2"> |
|||
<Select id="drop2" name="drop2" onchange="return listTeam('drop2','team2_div','team1_div',true);"> |
|||
<c:forEach var="team" items= "${teams}" varStatus="i"> |
|||
<Option value="${i.index}">${team.name}</ Option> |
|||
</c:forEach> |
|||
</select> |
|||
<div id="team2_div"></div> |
|||
</li> |
|||
|
|||
<li class="wide" id="divTrade" style="display: none;"> |
|||
<div class="cn"> |
|||
<div id="loader" style="width: 100%;text-align: center;margin-top: 15px"> |
|||
<span><c:out value="Calculating best trades" /></span> |
|||
<span class="l-1"></span> |
|||
<span class="l-2"></span> |
|||
<span class="l-3"></span> |
|||
<span class="l-4"></span> |
|||
<span class="l-5"></span> |
|||
<span class="l-6"></span> |
|||
</div> |
|||
</div> |
|||
<div id="trade_div"></div> |
|||
|
|||
</li> |
|||
</ul> |
|||
</article> |
|||
<footer class="main-footer">The footer</footer> |
|||
</div> |
|||
|
|||
|
|||
|
|||
</body> |
|||
</html> |
|||
|
|||
|
|||
|
After Width: | Height: | Size: 28 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 174 B |
|
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue