<commit_before>package controllers

import models.DObject
import play.mvc.results.Result

/**
 *
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 */

object DObjects extends DelvingController {

  def list(user: Option[String], query: String, page: Int = 1): AnyRef = {

    // TODO access rights
    val objectsPage = user match {
      case Some(u) => DObject.queryWithUser(query, browsedUserId).page(page)
      case None => DObject.queryAll(query).page(page)
    }

    val items: List[ListItem] = objectsPage._1
    request.format match {
      case "html" => Template("/list.html", 'title -> listPageTitle("object"), 'itemName -> "object", 'items -> items, 'page -> page, 'count -> objectsPage._2)
      case "json" => Json(items)
    }
  }

  def dobject(user: String, id: String): Result = {
    DObject.findById(id) match {
        case None => NotFound
        case Some(anObject) => {<commit_msg>Fixing user list template lookup (case)<commit_after>package controllers

import models.DObject
import play.mvc.results.Result

/**
 *
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 */

object DObjects extends DelvingController {

  def list(user: Option[String], query: String, page: Int = 1): AnyRef = {

    // TODO access rights
    val objectsPage = user match {
      case Some(u) => DObject.queryWithUser(query, browsedUserId).page(page)
      case None => DObject.queryAll(query).page(page)
    }

    val items: List[ListItem] = objectsPage._1
    request.format match {
      case "html" => Template("/user/list.html", 'title -> listPageTitle("object"), 'itemName -> "object", 'items -> items, 'page -> page, 'count -> objectsPage._2)
      case "json" => Json(items)
    }
  }

  def dobject(user: String, id: String): Result = {
    DObject.findById(id) match {
        case None => NotFound
        case Some(anObject) => {
{'fraction_non_alphanumeric': 0.14991939817302524, 'fraction_numerical': 0.0032240730789897904, 'mean_word_length': 3.300230946882217, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4487072', 'n_tokens_mistral': 591, 'n_tokens_neox': 577, 'n_words': 153}