summaryrefslogtreecommitdiffstats
path: root/dashboard/Yardstick-TC021-1456496043427
blob: d62b6d75be6423de2314adf0d94280da60bdb27c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
{
  "id": 15,
  "title": "Yardstick-TC021",
  "originalTitle": "Yardstick-TC021",
  "tags": [
    "yardstick-tc"
  ],
  "style": "dark",
  "timezone": "browser",
  "editable": true,
  "hideControls": false,
  "sharedCrosshair": false,
  "rows": [
    {
      "collapse": false,
      "editable": true,
      "height": "25px",
      "panels": [
        {
          "content": "",
          "editable": true,
          "error": false,
          "height": "30px",
          "id": 1,
          "isNew": true,
          "links": [],
          "mode": "markdown",
          "span": 12,
          "style": {},
          "title": "Test Case Execution",
          "type": "text"
        }
      ],
      "title": "Row"
    },
    {
      "collapse": false,
      "editable": true,
      "height": "25px",
      "panels": [
        {
          "content": "",
          "editable": true,
          "error": false,
          "height": "30px",
          "id": 2,
          "isNew": true,
          "links": [],
          "mode": "markdown",
          "span": 12,
          "style": {},
          "title": "Daily Averages",
          "type": "text"
        }
      ],
      "title": "New row"
    },
    {
      "collapse": false,
      "editable": true,
      "height": "250px",
      "panels": [
        {
          "content": "<br>\n<h2 style=\"font-family:Verdana\"> <a style=\"color:#31A7D3\"> This Test Case will be delivered in Brahmaputra-SR1</a></h3>\n<p>Currently under development.</p>\n<br>",
          "editable": true,
          "error": false,
          "height": "80px",
          "id": 3,
          "isNew": true,
          "links": [],
          "mode": "html",
          "span": 12,
          "style": {},
          "title": "Information",
          "type": "text"
        }
      ],
      "title": "New row"
    }
  ],
  "time": {
    "from": "now-6h",
    "to": "now"
  },
  "timepicker": {
    "refresh_intervals": [
      "5s",
      "10s",
      "30s",
      "1m",
      "5m",
      "15m",
      "30m",
      "1h",
      "2h",
      "1d"
    ],
    "time_options": [
      "5m",
      "15m",
      "1h",
      "6h",
      "12h",
      "24h",
      "2d",
      "7d",
      "30d"
    ]
  },
  "templating": {
    "list": []
  },
  "annotations": {
    "list": []
  },
  "schemaVersion": 8,
  "version": 1,
  "links": []
}
/span>"", blank=True, null=True) lab = models.ForeignKey(Lab, null=True, on_delete=models.SET_NULL) pdf = models.TextField(blank=True, default="") idf = models.TextField(blank=True, default="") class Meta: db_table = 'booking' def save(self, *args, **kwargs): """ Save the booking if self.user is authorized and there is no overlapping booking. Raise PermissionError if the user is not authorized Raise ValueError if there is an overlapping booking """ if self.start >= self.end: raise ValueError('Start date is after end date') # conflicts end after booking starts, and start before booking ends conflicting_dates = Booking.objects.filter(resource=self.resource).exclude(id=self.id) conflicting_dates = conflicting_dates.filter(end__gt=self.start) conflicting_dates = conflicting_dates.filter(start__lt=self.end) if conflicting_dates.count() > 0: raise ValueError('This booking overlaps with another booking') return super(Booking, self).save(*args, **kwargs) def delete(self, *args, **kwargs): res = self.resource self.resource = None self.save() resource_inventory.resource_manager.ResourceManager.getInstance().deleteResourceBundle(res) return super(self.__class__, self).delete(*args, **kwargs) def __str__(self): return str(self.purpose) + ' from ' + str(self.start) + ' until ' + str(self.end)