Example #1
0
void User::rate(Wt::Dbo::ptr< User > userPtr, const Media& media, int rating, Wt::Dbo::Transaction& transaction) {
  MediaRatingPtr previousRating = transaction.session().find<MediaRating>()
    .where("user_id = ?").bind(userPtr.id())
    .where("media_id = ?").bind(media.uid());
  if(!previousRating) {
    transaction.session().add(new MediaRating{userPtr, media.uid(), rating});
    return;
  }
  previousRating.modify()->setRating(rating);
}
Example #2
0
//TODO fazer isso
float AlunoList::getFrequencia(Wt::Dbo::ptr<SiconfModel::Disciplina> disciplina, Wt::Dbo::ptr<SiconfModel::Aluno>  aluno){

	Wt::Dbo::Transaction transaction(_dbSession);

	Wt::Dbo::collection<Wt::Dbo::ptr<SiconfModel::Aula>> aulas = _dbSession.find<SiconfModel::Aula>().where("aulas_disciplina_id = ?").bind(disciplina.id());

	return 0.0;
}