<commit_before>from models import Debate, Entry, Comment
from django.shortcuts import render_to_response
from django.db.models import Sum

def index(req):
  # list all debates by pubdate
  debates = Debate.objects.all().order_by('-pub_date')
  return render_to_response('index.html', {'debates': debates})

def getPoints(debate, user):
  return Comment.objects.filter(parentEntry__debate = debate, parentEntry__author = user).aggregate(Sum('parentPoints'))['parentPoints__sum']


def debate(req, id):
  debate = Debate.objects.get(id = id)
  c = { "debate": debate,
      "instigatorpoints": getPoints(debate, debate.instigator),
      "challengerpoints": getPoints(debate, debate.challenger),
      "entries": Entry.objects.filter(debate = debate)
      }
  return render_to_response('debate.html', c)<commit_msg>distinguish between debate points and comment points<commit_after>from models import Debate, Entry, Comment
from django.shortcuts import render_to_response
from django.db.models import Sum

def index(req):
  # list all debates by pubdate
  debates = Debate.objects.all().order_by('-pub_date')
  return render_to_response('index.html', {'debates': debates})

def getDebatePoints(debate, user):
  return Comment.objects.filter(parentEntry__debate = debate, parentEntry__author = user, parentComment = None).aggregate(Sum('parentPoints'))['parentPoints__sum']

def getCommentPoints(debate, user):
  raise Exception("not implemented yet")

def debate(req, id):
  debate = Debate.objects.get(id = id)
  c = { "debate": debate,
      "instigatorpoints": getDebatePoints(debate, debate.instigator),
      "challengerpoints": getDebatePoints(debate, debate.challenger),
      "entries": Entry.objects.filter(debate = debate)
      }
  return render_to_response('debate.html', c)
{'fraction_non_alphanumeric': 0.1210762331838565, 'fraction_numerical': 0.0, 'mean_word_length': 5.635687732342007, 'pattern_counts': {'":': 8, '<': 3, '<?xml version=': 0, '>': 3, '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': '6211272', 'n_tokens_mistral': 572, 'n_tokens_neox': 542, 'n_words': 126}