<div dir="ltr">Just one correction, it is sorting correctly when there&#39;s one workorder with a skill, if there&#39;s another workorder with same skill, it doesn&#39;t sort that workorder to that skill.<div><br><div style>
This is what is happening:</div><div><br></div><div style>Workorder skill ABC1   ------------   Engineer skill ABC1</div><div style>Workorder skill ABC2   ------------   Engineer skill ABC2<br></div><div style>Workorder skill ABC1   ------------   Engineer skill ABC2<br>
</div></div><div style><br></div><div style>but if there&#39;s only one workorder with one skill it works:</div><div style><br></div><div style><div>Workorder skill ABC1   ------------   Engineer skill ABC1</div><div>Workorder skill ABC2   ------------   Engineer skill ABC2<br>
</div><div>Workorder skill ABC3   ------------   Engineer skill ABC3</div><div><br></div><div style>so, from the second workorder on, with a repeated required skill, it doesn&#39;t sort properly</div></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">2013/2/19 André Fróes <span dir="ltr">&lt;<a href="mailto:arfmoraes@gmail.com" target="_blank">arfmoraes@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hello, since i&#39;m not moving a step from where I am at dsl rule, I&#39;m trying to do it with SimpleScoreCalculator, but the same is happening.<div><br></div><div>------------</div><div><div>public HardAndSoftScore calculateScore(Distributor distributor) {</div>

<div><span style="white-space:pre-wrap">                </span>int hardScore = 0;</div><div><span style="white-space:pre-wrap">                </span>int softScore = 0;</div><div><span style="white-space:pre-wrap">                </span></div><div><span style="white-space:pre-wrap">                </span>for (Engineer e : distributor.getEngineerList()){</div>

<div><span style="white-space:pre-wrap">                        </span>long skill = e.getSkillEngineerList().get(0).getSkill().getId();</div><div><span style="white-space:pre-wrap">                        </span>int requiredWorktime = 0;</div><div><span style="white-space:pre-wrap">                        </span>long requiredSkill = 0l;</div>

<div><span style="white-space:pre-wrap">                        </span></div><div><span style="white-space:pre-wrap">                        </span></div><div><span style="white-space:pre-wrap">                        </span>for (WorkOrder o : distributor.getWorkOrderList()){</div>
<div><span style="white-space:pre-wrap">                                </span>if (e.equals(o.getEngineer())){</div><div><span style="white-space:pre-wrap">                                        </span>requiredWorktime += o.getRequiredWorktime();</div><div><span style="white-space:pre-wrap">                                        </span>requiredSkill = o.getRequiredSkills().get(0).getSkill().getId();</div>

<div><span style="white-space:pre-wrap">                                </span>}</div><div><span style="white-space:pre-wrap">                        </span>}</div><div><span style="white-space:pre-wrap">                        </span></div><div><span style="white-space:pre-wrap">                        </span></div>

<div><span style="white-space:pre-wrap">                        </span>int engineerAvailableTime = e.getWorktime() - requiredWorktime;</div><div><span style="white-space:pre-wrap">                        </span>if (engineerAvailableTime &lt; 0 ){</div><div>
<span style="white-space:pre-wrap">                                </span>hardScore += engineerAvailableTime;</div><div><span style="white-space:pre-wrap">                        </span>}</div><div><span style="white-space:pre-wrap">                        </span></div><div><span style="white-space:pre-wrap">                        </span>if (requiredSkill == skill){</div>

<div><span style="white-space:pre-wrap">                                </span>softScore += requiredSkill;</div><div><span style="white-space:pre-wrap">                        </span>}</div><div><span style="white-space:pre-wrap">                </span>}</div><div><span style="white-space:pre-wrap">                </span>return DefaultHardAndSoftScore.valueOf(hardScore, softScore);</div>

<div><span style="white-space:pre-wrap">        </span>}</div></div><div>------------</div><div><br></div><div>wouldn&#39;t that have to fit since i&#39;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?</div>

</div>
</blockquote></div><br></div>