<commit_before>#!/usr/bin/env python2.5
#
# Copyright 2012 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Module for the GCI organization score page.
"""


from soc.views.helper import lists
from soc.views.helper import url_patterns
from soc.views.template import Template

from soc.modules.gci.models.score import GCIOrgScore
from soc.modules.gci.views.base import RequestHandler
from soc.modules.gci.views.helper import url_names
from soc.modules.gci.views.helper.url_patterns import url


class OrgScoresList(Template):
  """Template for the list students with the number of tasks they
  have completed for the specified organization.
  """

  ORG_SCORE_LIST_IDX = 0

  def __init__(self, request, data):
    self.request = request
    self.data = data
    r = data.redirect

    list_config = lists.ListConfiguration(add_key_column=False)
    list_config.addColumn('key', 'Key', (lambda ent, *args: "%s" % (
        ent.parent().key().id_or_name())), hidden=True)
    list_config.addColumn('student', 'Student',
        lambda e, *args: e.parent().name())
    list_config.addColumn('tasks', 'Tasks',
        lambda e, *args: e.numberOfTasks())
    list_config.setDefaultSort('tasks', 'desc')

    list_config.setRowAction(
        lambda e, *args: r.profile(e.parent().link_id).urlOf(
            url_names.GCI_STUDENT_TASKS))

    self._list_config = list_config

  def context(self):
    description = 'Organization score for for %s' % (
            self.data.organization.name)

    org_scores_list = lists.ListConfigurationResponse(
        self.data, self._list_config, self.ORG_SCORE_LIST_IDX, description)

    return {
        'lists': [org_scores_list],<commit_msg>Action for list of org scores redirects to list of the tasks completed by the user for the specified org.<commit_after>#!/usr/bin/env python2.5
#
# Copyright 2012 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Module for the GCI organization score page.
"""


from soc.views.helper import lists
from soc.views.helper import url_patterns
from soc.views.template import Template

from soc.modules.gci.models.score import GCIOrgScore
from soc.modules.gci.views.base import RequestHandler
from soc.modules.gci.views.helper import url_names
from soc.modules.gci.views.helper.url_patterns import url


class OrgScoresList(Template):
  """Template for the list students with the number of tasks they
  have completed for the specified organization.
  """

  ORG_SCORE_LIST_IDX = 0

  def __init__(self, request, data):
    self.request = request
    self.data = data
    r = data.redirect

    list_config = lists.ListConfiguration(add_key_column=False)
    list_config.addColumn('key', 'Key', (lambda ent, *args: "%s" % (
        ent.parent().key().id_or_name())), hidden=True)
    list_config.addColumn('student', 'Student',
        lambda e, *args: e.parent().name())
    list_config.addColumn('tasks', 'Tasks',
        lambda e, *args: e.numberOfTasks())
    list_config.setDefaultSort('tasks', 'desc')

    list_config.setRowAction(
        lambda e, *args: r.userOrg(user=e.parent().link_id).urlOf(
            url_names.GCI_STUDENT_TASKS_FOR_ORG))

    self._list_config = list_config

  def context(self):
    description = 'Organization score for for %s' % (
            self.data.organization.name)

    org_scores_list = lists.ListConfigurationResponse(
        self.data, self._list_config, self.ORG_SCORE_LIST_IDX, description)

    return {
        'lists': [org_scores_list],
{'fraction_non_alphanumeric': 0.10077691453940067, 'fraction_numerical': 0.0048834628190899, 'mean_word_length': 3.881906825568797, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3816582', 'n_tokens_mistral': 1360, 'n_tokens_neox': 1314, 'n_words': 420}