| # Copyright 2014 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. |
| |
| """Seeder functions for task counts model.""" |
| |
| from codein.models import task_counts as task_counts_model |
| |
| |
| def seedStudentTaskCountForOrg(student_key, org_key, completed_tasks_count): |
| """Seeds a new task counts for the specified student and organization. |
| |
| Args: |
| student_key: ndb.Key of the student. |
| org_key: ndb.Key of the organization. |
| completed_tasks_count: Number of tasks completed by the student. |
| |
| Returns: |
| They newly seeded task_counts_model.StudentTaskCountForOrg entity. |
| """ |
| task_counts = task_counts_model.StudentTaskCountForOrg( |
| parent=student_key, organization=org_key, |
| completed_tasks_count=completed_tasks_count) |
| task_counts.put() |
| return task_counts |