• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

gcivil-nyu-org / wed-fall24-team4 / #627816045

06 Nov 2024 02:07AM UTC coverage: 86.893%. First build
#627816045

Pull #132

travis-ci

Pull Request #132: Added Reporting functionality

165 of 175 new or added lines in 10 files covered. (94.29%)

716 of 824 relevant lines covered (86.89%)

0.87 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.83
/reporting/models.py
1
from django.contrib.auth.models import User
1✔
2
from django.db import models
1✔
3

4

5
def get_station_choices():
1✔
6
    import json
1✔
7

8
    with open("data/accessiblemta.json", "r") as file:
1✔
9
        data = json.load(file)
1✔
10

11
    station_names = list(set([x["stop_name"] for x in data]))
1✔
12
    return [(str(x).upper(), str(x)) for x in station_names]
1✔
13

14

15
class Infrastructure(models.TextChoices):
1✔
16
    RAMP = "ramp"
1✔
17
    ELEVATOR = "elevator"
1✔
18
    ESCALATOR = "escalator"
1✔
19

20

21
class Status(models.TextChoices):
1✔
22
    ACTIVE = "active"
1✔
23
    BROKEN = "broken"
1✔
24
    MAINTENANCE = "maintenance"
1✔
25

26

27
class Report(models.Model):
1✔
28
    sender = models.ForeignKey(User, related_name="report", on_delete=models.CASCADE)
1✔
29
    station = models.CharField(choices=get_station_choices(), max_length=40)
1✔
30
    infrastructure = models.CharField(choices=Infrastructure.choices, max_length=9)
1✔
31
    status = models.CharField(choices=Status.choices, max_length=11)
1✔
32
    timestamp = models.DateTimeField(auto_now_add=True)
1✔
33

34
    def __str__(self):
1✔
NEW
35
        return f"Report from {self.sender} about {self.station}'s \
×
36
            {self.infrastructure}'s status being {self.status} at {self.timestamp}"
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc