<commit_before>package controllers

// import play.api._
import play.api.mvc.{Controller, Action}
import play.api.data.Form
import play.api.data.Forms._
import play.api.libs.json.Json

import library.Util
import views._

import models.Member
import models.Post
import models.Comment
import models.CustomData

import java.util.Date

object EntryController extends Controller {
  val commentForm = Form(
      tuple(
          "post_id" -> number,
          "uname" -> text,
          "content" -> text
          ))

//  def index(createdAt: String) = Action {
//    implicit request => {
//      val memberId = Member.selectByUname(Util.getUnameFromSubdomain(request.domain)).get.id
//      Post.postByMemberIdAndCreatedAt(memberId, createdAt.toLong) match {
//        case Some(entry) => {
//          val css = CustomData.loadCss(memberId, "page")
//          val js = CustomData.loadJs(memberId, "page")
//          val uname = Util.getUnameFromSubdomain(request.domain)
//          Ok(html.entry(request.session.get("uname"), css, js, uname, entry, Comment.commentsByPostId(entry.id)))
//        }
//        case None => BadRequest("その記事存在しないです...")
//      }
//    }
//  }

  def index(createdAt: String, uname: String) = Action {
    implicit request => {
      val memberId = Member.selectByUname(uname).get.id
      Post.postByMemberIdAndCreatedAt(memberId, createdAt.toLong) match {
        case Some(entry) => {
          val css = CustomData.loadCss(memberId, "page")
          val js = CustomData.loadJs(memberId, "page")
          val uname = Util.getUnameFromSubdomain(request.domain)
          Ok(html.entry(request.session.get("uname"), css, js, uname, entry, Comment.commentsByPostId(entry.id)))
        }<commit_msg>Change the way to get uname for entry page.<commit_after>package controllers

// import play.api._
import play.api.mvc.{Controller, Action}
import play.api.data.Form
import play.api.data.Forms._
import play.api.libs.json.Json

import library.Util
import views._

import models.Member
import models.Post
import models.Comment
import models.CustomData

import java.util.Date

object EntryController extends Controller {
  val commentForm = Form(
      tuple(
          "post_id" -> number,
          "uname" -> text,
          "content" -> text
          ))

//  def index(createdAt: String) = Action {
//    implicit request => {
//      val memberId = Member.selectByUname(Util.getUnameFromSubdomain(request.domain)).get.id
//      Post.postByMemberIdAndCreatedAt(memberId, createdAt.toLong) match {
//        case Some(entry) => {
//          val css = CustomData.loadCss(memberId, "page")
//          val js = CustomData.loadJs(memberId, "page")
//          val uname = Util.getUnameFromSubdomain(request.domain)
//          Ok(html.entry(request.session.get("uname"), css, js, uname, entry, Comment.commentsByPostId(entry.id)))
//        }
//        case None => BadRequest("その記事存在しないです...")
//      }
//    }
//  }

  def index(createdAt: String, uname: String) = Action {
    implicit request => {
      val memberId = Member.selectByUname(uname).get.id
      Post.postByMemberIdAndCreatedAt(memberId, createdAt.toLong) match {
        case Some(entry) => {
          val css = CustomData.loadCss(memberId, "page")
          val js = CustomData.loadJs(memberId, "page")
          Ok(html.entry(Option(uname), css, js, uname, entry, Comment.commentsByPostId(entry.id)))
        }
{'fraction_non_alphanumeric': 0.13114754098360656, 'fraction_numerical': 0.0, 'mean_word_length': 2.7882483370288247, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '6803552', 'n_tokens_mistral': 1071, 'n_tokens_neox': 1061, 'n_words': 221}