This commit is contained in:
@@ -9,7 +9,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.springframework.validation.BindException;
|
import org.springframework.validation.BindException;
|
||||||
import org.springframework.validation.Errors;
|
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
import org.springframework.web.servlet.mvc.SimpleFormController;
|
import org.springframework.web.servlet.mvc.SimpleFormController;
|
||||||
import org.springframework.web.servlet.view.RedirectView;
|
import org.springframework.web.servlet.view.RedirectView;
|
||||||
@@ -52,12 +52,12 @@ public class ChoosePreferenceController extends SimpleFormController {
|
|||||||
ArrayList<Preference> preferencesList = new ArrayList<Preference>();
|
ArrayList<Preference> preferencesList = new ArrayList<Preference>();
|
||||||
Preference pref;
|
Preference pref;
|
||||||
for(Article article : articleList){
|
for(Article article : articleList){
|
||||||
pref = articleManager.getArticlePreferenceForUser(article.getId(), toto.getLogin());
|
pref = articleManager.getPreferenceForUserAndArticle(article.getId(), toto.getLogin());
|
||||||
if(pref == null){
|
if(pref == null){
|
||||||
pref = new Preference();
|
pref = new Preference();
|
||||||
pref.setArticle(article);
|
pref.setArticle(article);
|
||||||
pref.setPcMember(toto);
|
pref.setPcMember(toto);
|
||||||
pref.setPreference("Indifferent");
|
pref.setPreferenceType(Preference.PreferenceType.INDIFFERENT);
|
||||||
}
|
}
|
||||||
preferencesList.add(pref);
|
preferencesList.add(pref);
|
||||||
}
|
}
|
||||||
@@ -78,8 +78,7 @@ public class ChoosePreferenceController extends SimpleFormController {
|
|||||||
List<Preference> listPreference=fp.getPreferences();
|
List<Preference> listPreference=fp.getPreferences();
|
||||||
|
|
||||||
for(Preference preference : listPreference){
|
for(Preference preference : listPreference){
|
||||||
articleManager.addOrUpdatePreference(
|
articleManager.addPreference(preference.getArticle().getId(),
|
||||||
preference.getArticle().getId(),
|
|
||||||
preference.getPcMember().getLogin(),
|
preference.getPcMember().getLogin(),
|
||||||
preference.getPreference());
|
preference.getPreference());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user