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

gcivil-nyu-org / INT2-Monday-Spring2024-Team-2 / 13

01 Mar 2024 05:17PM UTC coverage: 65.975%. First build
13

push

travis-pro

web-flow
Merge pull request #39 from gcivil-nyu-org/feature/shihui

Set up Travis CI

36 of 69 new or added lines in 7 files covered. (52.17%)

159 of 241 relevant lines covered (65.98%)

0.66 hits per line

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

72.22
/TutorRegister/TutorForm.py
1
from django import forms
1✔
2
from django.core.validators import RegexValidator, MinValueValidator
1✔
3

4

5
class TutorForm(forms.Form):
1✔
6
    GENDER_CHOICES = [
1✔
7
        ("male", "Male"),
8
        ("female", "Female"),
9
    ]
10

11
    PREFERRED_MODE_CHOICES = [
1✔
12
        ("online", "Online"),
13
        ("in_person", "In-person"),
14
    ]
15

16
    gender = forms.ChoiceField(choices=GENDER_CHOICES, label="Gender")
1✔
17
    zip_code = forms.CharField(
1✔
18
        max_length=10,
19
        label="Zip Code",
20
        validators=[RegexValidator(r"^\d{5}$", message="Enter a valid ZIP code.")],
21
    )
22
    major = forms.CharField(max_length=100, label="Major")
1✔
23
    preferred_mode = forms.ChoiceField(
1✔
24
        choices=PREFERRED_MODE_CHOICES, label="Preferred Mode"
25
    )
26
    introduction = forms.CharField(widget=forms.Textarea, label="Introduction")
1✔
27
    min_salary = forms.IntegerField(
1✔
28
        validators=[MinValueValidator(0)], label="Minimum Salary ($)"
29
    )
30
    max_salary = forms.IntegerField(
1✔
31
        validators=[MinValueValidator(0)], label="Maximum Salary ($)"
32
    )
33

34
    def clean(self):
1✔
35
        cleaned_data = super().clean()
×
NEW
36
        min_salary = cleaned_data.get("min_salary")
×
NEW
37
        max_salary = cleaned_data.get("max_salary")
×
38

39
        if (
×
40
            min_salary is not None
41
            and max_salary is not None
42
            and min_salary > max_salary
43
        ):
NEW
44
            raise forms.ValidationError(
×
45
                "Minimum salary must be less than or equal to maximum salary"
46
            )
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

© 2026 Coveralls, Inc