[chronojump-server] Changed last attributes to same name pattern. Updated diagram. Allowing tasks again



commit b1166f47e5ad62a2c151b7a92939b045e0314f3d
Author: Max Ros i Morejon <mros33 gmail com>
Date:   Sun Oct 21 19:31:42 2018 +0200

    Changed last attributes to same name pattern. Updated diagram. Allowing tasks again

 .../chronojump_networks/tasks/api/urls.py             |   2 +-
 .../chronojump_networks/tasks/api/views.py            |  15 ++++++++-------
 .../chronojump_networks/tasks/models.py               |  10 +++++-----
 .../organizations/groups/group_players_list.html      |  10 +++++-----
 diagrams/networks.dia                                 | Bin 4838 -> 4645 bytes
 5 files changed, 19 insertions(+), 18 deletions(-)
---
diff --git a/chronojumpserver-django/chronojump_networks/tasks/api/urls.py 
b/chronojumpserver-django/chronojump_networks/tasks/api/urls.py
index e008266..1164cbc 100644
--- a/chronojumpserver-django/chronojump_networks/tasks/api/urls.py
+++ b/chronojumpserver-django/chronojump_networks/tasks/api/urls.py
@@ -12,7 +12,7 @@ urlpatterns = [
         name='tasks'
     ),
     url(
-        regex=r'^(?P<task_id>\d+)$',
+        regex=r'^(?P<taskId>\d+)$',
         view=views.TaskRetrieveUpdateDestroyAPIView.as_view(),
         name='tasks'
     ),
diff --git a/chronojumpserver-django/chronojump_networks/tasks/api/views.py 
b/chronojumpserver-django/chronojump_networks/tasks/api/views.py
index fa7b373..294ec90 100644
--- a/chronojumpserver-django/chronojump_networks/tasks/api/views.py
+++ b/chronojumpserver-django/chronojump_networks/tasks/api/views.py
@@ -19,12 +19,13 @@ class ListCreateAPIView(ListCreateAPIView):
     def create(self, request, *args, **kwargs):
         data = dict(request.data)
         # TODO: Sure there is a better way to do this
+        print(data)
         o = Task.objects.create(
-            person_id = int(data['person_id'][0]),
-            coach_id = int(data['coach_id'][0]),
-            gym_id = int(data['gym_id'][0]),
-            station_id = int(data['station_id'][0]),
-            exercise_id = int(data['exercise_id'][0]),
+            person_id = int(data['personId'][0]),
+            coach_id = int(data['coachId'][0]),
+            gym_id = int(data['gymId'][0]),
+            station_id = int(data['stationId'][0]),
+            exercise_id = int(data['exerciseId'][0]),
             type = data['type'][0],
             load = float(data['load'][0]),
             speed = float(data['speed'][0]),
@@ -43,10 +44,10 @@ class TaskRetrieveUpdateDestroyAPIView(RetrieveUpdateDestroyAPIView):
 
     permission_classes = (IsAuthenticated, )
     serializer_class = TaskSerializer
-    lookup_field = 'task_id'
+    lookup_field = 'taskId'
 
     def retrieve(self, request, *args, **kwars):
         #print(self.kwargs['task_id'])
-        o = get_object_or_404(Task, id=self.kwargs['task_id'])
+        o = get_object_or_404(Task, id=self.kwargs['taskId'])
         s = TaskSerializer(o)
         return Response(s.data)
diff --git a/chronojumpserver-django/chronojump_networks/tasks/models.py 
b/chronojumpserver-django/chronojump_networks/tasks/models.py
index 400e8a7..c3f580f 100644
--- a/chronojumpserver-django/chronojump_networks/tasks/models.py
+++ b/chronojumpserver-django/chronojump_networks/tasks/models.py
@@ -28,29 +28,29 @@ class Task(models.Model):
     ts = models.DateTimeField(auto_now_add=True)
     person = models.ForeignKey(Player,
                                on_delete = models.CASCADE,
-                               db_column='person_id',
+                               db_column='personId',
                                related_name='player_tasks')
     coach = models.ForeignKey(User,
                               on_delete = models.SET_NULL,
-                              db_column = 'coach_id',
+                              db_column = 'coachId',
                               related_name = 'coach_tasks',
                               null=True)
 
     gym = models.ForeignKey(Gym,
                             on_delete = models.CASCADE,
-                            db_column='gym_id',
+                            db_column='gymId',
                             related_name='gym_tasks',
                             null=True)
 
     station = models.ForeignKey(Station,
                             on_delete = models.CASCADE,
-                            db_column='station_id',
+                            db_column='stationId',
                             related_name='station_tasks',
                             null=True)
 
     exercise = models.ForeignKey(Exercise,
                             on_delete = models.CASCADE,
-                            db_column='exercise_id',
+                            db_column='exerciseId',
                             related_name='exercise_tasks',
                             null=True)
 
diff --git 
a/chronojumpserver-django/chronojump_networks/templates/organizations/groups/group_players_list.html 
b/chronojumpserver-django/chronojump_networks/templates/organizations/groups/group_players_list.html
index 637e1b8..687f272 100644
--- a/chronojumpserver-django/chronojump_networks/templates/organizations/groups/group_players_list.html
+++ b/chronojumpserver-django/chronojump_networks/templates/organizations/groups/group_players_list.html
@@ -569,10 +569,10 @@
       let coach_id = {{ user.id }};
       var task = {
         'type' : 'S',
-        'person_id': person_id,
-        'gym_id': gym_id,
-        'station_id': station_id,
-        'exercise_id': exercise_id,
+        'personId': person_id,
+        'gymId': gym_id,
+        'stationId': station_id,
+        'exerciseId': exercise_id,
         'sets' : sets,
         'nreps' : nreps,
         'load' : load,
@@ -582,7 +582,7 @@
         'comment': comment,
         'lossByPower': lossByPower,
         'lossBySpeed': lossBySpeed,
-        'coach_id': 2
+        'coachId': coach_id
       }
       console.log(task);
       return task;
diff --git a/diagrams/networks.dia b/diagrams/networks.dia
index 991fd20..964f07c 100644
Binary files a/diagrams/networks.dia and b/diagrams/networks.dia differ


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]