Skip to content

Commit

Permalink
Merge pull request #2 from carlosvasquez/master
Browse files Browse the repository at this point in the history
Afinamiento de diseño
  • Loading branch information
carlosvasquez committed Jun 2, 2014
2 parents 46633ef + e986add commit a8cbe29
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 15 deletions.
5 changes: 3 additions & 2 deletions src/main/java/org/devdom/client/facebook/Callback.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response) t
try {
facebook.getOAuthAccessToken(oauthCode);
setProfile(request,facebook);
} catch (FacebookException e){
throw new ServletException(e);
} catch (FacebookException e){
request.getSession().invalidate();
response.sendRedirect("index.xhtml");
}
response.sendRedirect(request.getContextPath() + "/");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public MenuModel getMenuItems(){
submenu.setId("influencersMenu");

List<GroupRating> groups = getGroupsRating();

if(groups.size()>0){
groups = groups.subList(3, groups.size());
groups.stream().forEach((group) -> {
Expand All @@ -210,8 +210,7 @@ public MenuModel getMenuItems(){
item.setUrl("/groupTop20.xhtml?g="+ group.getGroupId());
item.setStyle("font-size:12px;");
if(group.getGroupId().equals(groupId)){
item.setStyle("color:red");
item.setStyle("font-size:12px;");
item.setStyle("color:red;font-size:12px;");
}
submenu.addElement(item);
});
Expand Down
21 changes: 18 additions & 3 deletions src/main/java/org/devdom/tracker/bean/TopController.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
@RequestScoped
public class TopController implements Serializable{

List<Top> top20;
List<Top> top;
/**
* Listado de los 20 developers más influyentes de todos los grupos
* @return
Expand All @@ -30,12 +30,27 @@ public List<Top> getTop20Devs(){
String groupId = request.get("g");
try {
TopDao topdao = new TopDao();
top20 = topdao.findTop20Devs(groupId);
top = topdao.findTop20Devs(groupId);
} catch (Exception ex) {
ex.printStackTrace();
return null;
}
return top20;
return top;
}

public List<Top> getTop300Devs(){
ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
Map<String,String> request = externalContext.getRequestParameterMap();

String groupId = request.get("g");
try {
TopDao topdao = new TopDao();
top = topdao.findTop300Devs(groupId);
} catch (Exception ex) {
ex.printStackTrace();
return null;
}
return top;
}

}
24 changes: 24 additions & 0 deletions src/main/java/org/devdom/tracker/model/dao/TopDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,29 @@ public List<Top> findTop20Devs(String groupId) throws Exception{
}
return list;
}

/**
* Top 300 de los developers más influyentes según su trayectoría
*
* @param groupId
* @return
* @throws Exception
*/
public List<Top> findTop300Devs(String groupId) throws Exception{
EntityManagerFactory emf = Persistence.createEntityManagerFactory("jpa");
EntityManager em = emf.createEntityManager();
List<Top> list;
try{
list = (List<Top>) em.createNamedQuery("Top.findTop300DevsInfluents")
.getResultList();
}finally{
if(em!=null|em.isOpen())
em.close();

if(emf.isOpen())
emf.close();
}
return list;
}

}
9 changes: 7 additions & 2 deletions src/main/java/org/devdom/tracker/model/dto/Top.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,15 @@
name="group_id",
direction=Direction.IN,
type=String.class)}
),
@NamedStoredProcedureQuery( name="Top.findTop300DevsInfluents",
procedureName="findTop300DevsInfluents",
returnsResultSet=true,
resultClass=Top.class
)
})
public class Top implements Serializable {

@Id
@Column(name = "position")
private int position;
Expand Down Expand Up @@ -184,7 +189,7 @@ public void setRatio(double ratio) {
* @return the picture
*/
public String getPicture() {
return picture;
return "https://graph.facebook.com/"+this.fromId+"/picture?height=80&width=80";
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public void setRatio(double ratio) {
* @return the picture
*/
public String getPicture() {
return picture;
return "https://graph.facebook.com/"+this.fromId+"/picture?height=130&width=140";
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/groupTop20.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

<p:panel header="##{dev.position} #{dev.fullName}" style="font-size:12px;text-align:center;width:90%;">
<h:panelGrid columns="1" style="width:130px;text-align: left;">
<p:graphicImage value="#{dev.picture}" height="80"/>
<p:graphicImage value="#{dev.picture}"/>
<b>Rating:</b> #{dev.ratio}<br/>
<b>Posts:</b> #{dev.postsCount}<br/>
<b>Comments:</b> #{dev.messagesCount}<br/>
Expand Down
6 changes: 3 additions & 3 deletions src/main/webapp/resources/css/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
top:-1px;
float:left;
left:4px;
overflow:scroll;
/*overflow:scroll;*/
}

.dev-carrousel-button{
Expand Down Expand Up @@ -141,11 +141,11 @@
position: relative;
top: 5px;
}

/*
.ui-layout-unit-content .ui-widget-content{
overflow:hidden;
}

*/
p{
font-size: 30px; line-height: 30px
}
Expand Down

0 comments on commit a8cbe29

Please sign in to comment.