Just one correction, it is sorting correctly when there's one workorder with a skill, if there's another workorder with same skill, it doesn't sort that workorder to that skill.

This is what is happening:

Workorder skill ABC1   ------------   Engineer skill ABC1
Workorder skill ABC2   ------------   Engineer skill ABC2
Workorder skill ABC1   ------------   Engineer skill ABC2

but if there's only one workorder with one skill it works:

Workorder skill ABC1   ------------   Engineer skill ABC1
Workorder skill ABC2   ------------   Engineer skill ABC2
Workorder skill ABC3   ------------   Engineer skill ABC3

so, from the second workorder on, with a repeated required skill, it doesn't sort properly


2013/2/19 André Fróes <arfmoraes@gmail.com>
Hello, since i'm not moving a step from where I am at dsl rule, I'm trying to do it with SimpleScoreCalculator, but the same is happening.

------------
public HardAndSoftScore calculateScore(Distributor distributor) {
int hardScore = 0;
int softScore = 0;
for (Engineer e : distributor.getEngineerList()){
long skill = e.getSkillEngineerList().get(0).getSkill().getId();
int requiredWorktime = 0;
long requiredSkill = 0l;
for (WorkOrder o : distributor.getWorkOrderList()){
if (e.equals(o.getEngineer())){
requiredWorktime += o.getRequiredWorktime();
requiredSkill = o.getRequiredSkills().get(0).getSkill().getId();
}
}
int engineerAvailableTime = e.getWorktime() - requiredWorktime;
if (engineerAvailableTime < 0 ){
hardScore += engineerAvailableTime;
}
if (requiredSkill == skill){
softScore += requiredSkill;
}
}
return DefaultHardAndSoftScore.valueOf(hardScore, softScore);
}
------------

wouldn't that have to fit since i'm comparing the 1st attribute of each skill list from engineers and workorders? And how can I weight which engineer would be better to a determined workorder if the workorder have more skills and so does the engineer?