JJ Racing medal 5000 11 years 16 days ago (edited 11 years 16 days ago)
"Jaap
It'd be nice, yeah. It could be a simple code I believe.
It also happens when you're in a league, and promote, but then directly leave. You might have spend five minutes in that tier, but it stays to show on your summary.
I think the importance of these statistics can't be underestimated. They're very important for manangers, building their team makes them proud. It's a vanity, like the livery, but still, it grows onto you.
I don't know.. It just depens how races and teams and leagues are related to each others in database. However I think database should be made that way, it'd be an easy operation from coding side.
Using C# it would went something like (with basic Silverlight application architecture):
client side dataModel code:
public LeaguePageDataModel()
{
//Beware no multiple callback methods made
Client.GetLeaguesTeamHaveRacedCompleted += Client_GetTeamsRacedLeaguesCompleted;
//You have to have team identifier somewhere to get the leagues you want, lol! :D
GetLeaguesTeamHaveRaced(Guid teamIdentifier);
}
private ObservableCollection<LeagueDto> _leagues;
//Binded league information shown to user in UI
public ObservableCollection<LeagueDto> Leagues
{
get { return _leagues; }
set
{
_leagues = value;
CustomNotifier(
"Leagues")
}
}
private void GetLeaguesTeamHaveRaced(
Guid teamIdentifier)
{
//Client must be connected separately in base model
Client.GetTeamsRacedLeaguesAsync(teamIdentifier);
}
private void Client_GetTeamsRacedLeaguesCompleted(
object sender,
GetTeamsRacedLeaguesCompletedEventArgs e)
{
Leagues = e.Result;
}
You could of course filter data in client side code, if you need more complicated data sets available in user interface. In this example however you'd need WCF dataservice to hold your database operations like:
public List<LeagueDto> GetLeaguesTeamHaveRaced(
Guid teamIdentifier)
{
var leagueQry =
from teams
in DatabaseEntities.TeamDto
where TeamDto.Id == teamIdentifier
join teamLeagueHistory
in Database.TeamLeagueHistoryDto
on teamLeagueHistory.TeamId
equals teams.Id
where teamLeagueHistory.Races > 0
//then you'd need database trigger to count that Races there too, but obivously it is yet available
join leagues
in DatabaseEntities.LeagueDto
on leagues.Id
equals teamLeagueHistory.LeagueId select teamLeagueHistory;
return leagueQry.ToList();
}
which need to be implemented too:
[OperationContract]
List<LeagueDto> GetLeaguesTeamHaveRaced(
Guid teamIdentifier);
This was just plain example, how it could be and there's not even custom UI objects or filters made and then you need to think the way and what data should be transferred and in which form (should not be too important with one function and base architecture should be neat, so you could easier implement new functionalities to code). Then there is things like user authentication for example, you have to worry in code. But what I'm trying to say that there is heck lot of things could went wrong too and in coding side it is never just not like picking berries or something like that, what would be easy to do. If you wan't more juice, you just pick more berries.. But you can do that too in right way or not. But I sure agree the idea.
I think it is just, iGP crew has so many ideas in line, so it's about resources too, what can actually be done. I mean, doesn't we all have limited resources to make everyone happy :)