Example #1
0
 def testMakeAndRecallHouseReport(self):
     house = House(address="13 NeverLand Lane",
                   date_created=datetime.datetime(2018, 4, 3, tzinfo=UTC))
     house.save()
     house_report = HouseReport(
         house_filed=house,
         author=self.user_1,
         moved_in_date=datetime.datetime(2018, 1, 3, tzinfo=UTC),
         moved_out_date=datetime.datetime(2018, 12, 10, tzinfo=UTC),
         landlord_responsiveness=3,
         repair_quality=3,
         water_pressure=3,
         utilities=3,
         furniture_quality=3,
         mattress_quality=3,
         build_quality=3,
         quietness=3,
         pest_free=3,
         smells=3,
         damp_mould_free=3,
         monthly_rent=2000,
         monthly_bills=10,
     )
     house_report.save()
     reports = HouseReport.objects.filter(house_filed=house)
     self.assertEqual(len(reports), 1)
     self.assertEquals(reports[0], house_report)
Example #2
0
 def testMakeAndRecallHouseModel(self):
     time1 = datetime.datetime(year=2018, month=5, day=30, tzinfo=UTC)
     time2 = datetime.datetime(year=2018, month=2, day=15, tzinfo=UTC)
     House.objects.create(address="10 Downing Street", date_created=time1)
     House.objects.create(address="101 Dalmatian Lane", date_created=time2)
     house1 = House.objects.get(address="10 Downing Street")
     house2 = House.objects.get(address="101 Dalmatian Lane")
     self.assertEqual(house1.date_created, time1)
     self.assertEqual(house2.date_created, time2)
Example #3
0
    def get_queryset(self):
        year1, month1, day1 = itemgetter("year1", "month1",
                                         "day1")(self.kwargs)
        year2, month2, day2 = itemgetter("year2", "month2",
                                         "day2")(self.kwargs)

        date1 = datetime.datetime(int(year1), int(month1), int(day1))
        date2 = datetime.datetime(int(year2), int(month2), int(day2))

        qs = Type1.objects.filter(Check_In__range=(date1, date2))

        return qs
Example #4
0
def reservation_form(user):
    t = teams_can_reserv(user)
    actual_tour = TourNumber.objects.filter(
        league__championship__is_active=True,
        is_actual=True,
        league__is_cup=False).first()

    matches_unplayed = Match.objects.filter(
        (Q(team_home__in=t) | Q(team_guest__in=t)),
        is_played=False,
        numb_tour__number__lte=actual_tour.number,
    ).order_by('-numb_tour__number')
    matches_to_choose = []

    for m in matches_unplayed:
        try:
            a = m.match_reservation
        except:
            matches_to_choose.append(m)

    date_today = datetime.datetime.today()
    d = date_today + timedelta(minutes=5)
    time_end = datetime.datetime(year=actual_tour.date_to.year,
                                 month=actual_tour.date_to.month,
                                 day=actual_tour.date_to.day,
                                 hour=23,
                                 minute=30,
                                 second=0)

    return {
        'matches': matches_to_choose,
        'date_today': d,
        'time_end': time_end,
        'user': user,
    }
Example #5
0
 def test_event_location(self):
     event_galaxy = Event.objects.get(name="something amazing")
     mocked = datetime.datetime(2020, 2, 20, 6, 0, 0, tzinfo=pytz.utc)
     with mock.patch('django.utils.timezone.now',
                     mock.Mock(return_value=mocked)):
         self.assertEqual(event_galaxy.location, "galaxy")
         self.assertEqual(event_galaxy.name, "something amazing")
         self.assertEqual(event_galaxy.start_time, mocked)
         self.assertEqual(event_galaxy.end_time, mocked)
Example #6
0
def convert_to_datetime(datetime_: str):
    time, date = datetime_.split()
    hours, mint = time.split(":")
    day, month, year = date.split("-")
    if mint[-2:] == "PM":
        hours = (int(hours) + 12) % 24
    mint = mint[:-2]
    month = DATE_MONTH[month]

    return datetime.datetime(int(year), int(month), int(day), int(hours),
                             int(mint))
Example #7
0
 def test_function_get_yoe(self):
     user = User.objects.create_user(
         employee_code="9999999",
         date_joined=datetime.datetime(2013,
                                       4,
                                       1,
                                       12,
                                       00,
                                       00,
                                       000000,
                                       tzinfo=timezone.utc),
     )
     d = timezone.now() - user.date_joined
     yoe = int(d.days / 365)
     self.assertEqual(user.get_yoe(), yoe)
Example #8
0
 def set_up(self):
     doc = User.objects.create_user(email='*****@*****.**',
                                    password='******',
                                    is_doctor=True,
                                    name='Test_doc',
                                    family_name='Test_family_doc')
     patient = User.objects.create_user(email='*****@*****.**',
                                        password='******',
                                        is_doctor=False,
                                        name='Test_user',
                                        family_name='Test_family_user')
     doctor_profile = DoctorProfileInfo.objects.create(user=doc,
                                                       fee=10,
                                                       credit=100)
     event = Event.objects.create(doctor_user=doc,
                                  patient_user=patient,
                                  start_hour=12,
                                  start_time=datetime.datetime(2020, 12, 1))
     pres = Prescriptions.objects.create(appointment_id=event.id,
                                         doctor_id=doc.id,
                                         patient_id=patient.id)
     self.client.login(email='*****@*****.**', password='******')
     return pres, doc, patient, event
Example #9
0
    def handle(self, *args, **options):
        admin = LeagueUser.objects.create_superuser(username='******',
                                                    password='******')
        admin.save()
        for name in self.USERS_NAME:
            user = LeagueUser.objects.create(
                username=name,
                email=f'{name}@gmail.com',
                github_link=f'{self.GITHUB}{name}')
            user.set_password(r'password')
            self.USERS[user.username] = user
            user.save()

        cats = []
        for name, desc in zip(self.CATEGORY_NAMES, self.CATEGORY_DESC):
            cat = Category.objects.create(name=name, description=desc)
            cats.append(cat)
            cat.save()
        comp = Competition.objects.create(
            title='I Blockchain League',
            description=
            'Now it comes the I Blockchain League sponsered by Amazon.',
            owner=admin,
            data_start_inscription=datetime.datetime(year=2012,
                                                     month=3,
                                                     day=19,
                                                     hour=11,
                                                     minute=55,
                                                     second=00,
                                                     microsecond=182371),
            data_finish_inscription=datetime.datetime(year=2013,
                                                      month=4,
                                                      day=20,
                                                      hour=11,
                                                      minute=12,
                                                      second=00,
                                                      microsecond=182371),
            data_start_competition=datetime.datetime(year=2015,
                                                     month=5,
                                                     day=10,
                                                     hour=20,
                                                     minute=23,
                                                     second=00,
                                                     microsecond=182371),
            data_finish_competition=datetime.datetime(year=2017,
                                                      month=5,
                                                      day=31,
                                                      hour=21,
                                                      minute=16,
                                                      second=00,
                                                      microsecond=182371),
        )
        comp.categories.add(cats[0])
        comp.categories.add(cats[2])
        comp.save()

        team = Team.objects.create(name='Patatas de Gimeno')
        team.members.add(self.USERS['latra'])
        team.members.add(self.USERS['Oriolac'])
        team.members.add(self.USERS['Marta99'])
        team.competition = comp
        team.ranking = Ranking.objects.create(score=100).save()
        team.submition = Submit.objects.create(
            description='Submition of Patatas de Gimeno',
            githuburl='https://github.com/Oriolac/codeleague/',
            submit_date=datetime.datetime(year=2016,
                                          month=5,
                                          day=10,
                                          hour=20,
                                          minute=23,
                                          second=00,
                                          microsecond=182371),
            team_id=team.id)
        team.save()

        team = Team.objects.create(name='CodePlayers')
        team.members.add(self.USERS['pau1838'])
        team.members.add(self.USERS['quimpm'])
        team.members.add(self.USERS['sergisi'])
        team.members.add(self.USERS['Doasy'])
        team.competition = comp
        team.ranking = Ranking.objects.create(score=95).save()
        team.submition = Submit.objects.create(
            description='Submition of CodePlayers',
            githuburl='https://github.com/Oriolac/codeleague/',
            submit_date=datetime.datetime(year=2016,
                                          month=6,
                                          day=5,
                                          hour=10,
                                          minute=45,
                                          second=00,
                                          microsecond=182371),
            team_id=team.id)
        team.save()

        comp = Competition.objects.create(
            title='II Blockchain League',
            description=
            'Now it comes the II Blockchain League sponsered by Amazon.',
            owner=admin,
            data_start_inscription=datetime.datetime(year=2017,
                                                     month=3,
                                                     day=19,
                                                     hour=11,
                                                     minute=55,
                                                     second=00,
                                                     microsecond=182371),
            data_finish_inscription=datetime.datetime(year=2018,
                                                      month=4,
                                                      day=20,
                                                      hour=11,
                                                      minute=12,
                                                      second=00,
                                                      microsecond=182371),
            data_start_competition=datetime.datetime(year=2019,
                                                     month=5,
                                                     day=10,
                                                     hour=20,
                                                     minute=23,
                                                     second=00,
                                                     microsecond=182371),
            data_finish_competition=datetime.datetime(year=2022,
                                                      month=5,
                                                      day=31,
                                                      hour=21,
                                                      minute=16,
                                                      second=00,
                                                      microsecond=182371),
        )
        comp.categories.add(cats[0])
        comp.categories.add(cats[2])
        comp.save()

        team = Team.objects.create(name='SegmentationFault')
        team.members.add(self.USERS['notaiax'])
        team.members.add(self.USERS['pau1838'])
        team.members.add(self.USERS['horno'])
        team.competition = comp
        team.ranking = Ranking.objects.create(score=80).save()
        team.submition = Submit.objects.create(
            description='Submition of SegmentationFault',
            githuburl='https://github.com/Oriolac/codeleague/',
            submit_date=datetime.datetime(year=2020,
                                          month=6,
                                          day=5,
                                          hour=22,
                                          minute=45,
                                          second=00,
                                          microsecond=182371),
            team_id=team.id)
        team.save()

        team = Team.objects.create(name='LeetCode')
        team.members.add(self.USERS['quimpm'])
        team.members.add(self.USERS['Oriolac'])
        team.competition = comp
        team.ranking = Ranking.objects.create(score=70).save()
        team.submition = Submit.objects.create(
            description='Submition of LeetCode',
            githuburl='https://github.com/Oriolac/codeleague/',
            submit_date=datetime.datetime(year=2021,
                                          month=3,
                                          day=20,
                                          hour=17,
                                          minute=30,
                                          second=00,
                                          microsecond=182371),
            team_id=team.id)
        team.save()

        team = Team.objects.create(name='Team League')
        team.members.add(self.USERS['Marta99'])
        team.members.add(self.USERS['sergisi'])
        team.competition = comp
        team.ranking = Ranking.objects.create(score=70).save()
        team.submition = Submit.objects.create(
            description='Submition of LeetCode',
            githuburl='https://github.com/Oriolac/codeleague/',
            submit_date=datetime.datetime(year=2021,
                                          month=3,
                                          day=20,
                                          hour=17,
                                          minute=30,
                                          second=00,
                                          microsecond=182371),
            team_id=team.id)
        team.save()

        comp = Competition.objects.create(
            title='III Blockchain League',
            description=
            'Now it comes the III Blockchain League sponsered by Amazon.',
            owner=admin,
            data_start_inscription=datetime.datetime(year=2017,
                                                     month=3,
                                                     day=19,
                                                     hour=11,
                                                     minute=55,
                                                     second=00,
                                                     microsecond=182371),
            data_finish_inscription=datetime.datetime(year=2021,
                                                      month=4,
                                                      day=20,
                                                      hour=11,
                                                      minute=12,
                                                      second=00,
                                                      microsecond=182371),
            data_start_competition=datetime.datetime(year=2021,
                                                     month=5,
                                                     day=10,
                                                     hour=20,
                                                     minute=23,
                                                     second=00,
                                                     microsecond=182371),
            data_finish_competition=datetime.datetime(year=2024,
                                                      month=5,
                                                      day=31,
                                                      hour=21,
                                                      minute=16,
                                                      second=00,
                                                      microsecond=182371),
        )
        comp.categories.add(cats[0])
        comp.categories.add(cats[2])
        comp.save()

        team = Team.objects.create(name='APIs4Win')
        team.members.add(self.USERS['latra'])
        team.members.add(self.USERS['Marta99'])
        team.members.add(self.USERS['pau1838'])
        team.competition = comp
        team.ranking = Ranking.objects.create(score=90).save()
        team.submition = Submit.objects.create(
            description='Submition of APIs4Win',
            githuburl='https://github.com/Oriolac/codeleague/',
            submit_date=datetime.datetime(year=2021,
                                          month=7,
                                          day=20,
                                          hour=17,
                                          minute=30,
                                          second=00,
                                          microsecond=182371),
            team_id=team.id)
        team.save()

        team = Team.objects.create(name='Haskellerians')
        team.members.add(self.USERS['quimpm'])
        team.members.add(self.USERS['Oriolac'])
        team.members.add(self.USERS['horno'])
        team.members.add(self.USERS['sergisi'])
        team.competition = comp
        team.ranking = Ranking.objects.create(score=105).save()
        team.submition = Submit.objects.create(
            description='Submition of Haskellerians',
            githuburl='https://github.com/Oriolac/codeleague/',
            submit_date=datetime.datetime(year=2022,
                                          month=3,
                                          day=7,
                                          hour=19,
                                          minute=30,
                                          second=00,
                                          microsecond=182371),
            team_id=team.id)
        team.save()

        team = Team.objects.create(name='SuperCoders')
        team.members.add(self.USERS['Doasy'])
        team.members.add(self.USERS['notaiax'])
        team.competition = comp
        team.ranking = Ranking.objects.create(score=55).save()
        team.submition = Submit.objects.create(
            description='Submition of Supercoders',
            githuburl='https://github.com/Oriolac/codeleague/',
            submit_date=datetime.datetime(year=2022,
                                          month=5,
                                          day=13,
                                          hour=19,
                                          minute=30,
                                          second=00,
                                          microsecond=182371),
            team_id=team.id)
        team.save()

        comp = Competition.objects.create(
            title='I Deep Learning League',
            description=
            'LleidaHack has creted the first Deep Learning League. You can '
            'join the league before competition starts.',
            owner=admin,
            data_start_inscription=datetime.datetime(year=2017,
                                                     month=3,
                                                     day=19,
                                                     hour=11,
                                                     minute=55,
                                                     second=00,
                                                     microsecond=182371),
            data_finish_inscription=datetime.datetime(year=2023,
                                                      month=4,
                                                      day=20,
                                                      hour=11,
                                                      minute=12,
                                                      second=00,
                                                      microsecond=182371),
            data_start_competition=datetime.datetime(year=2019,
                                                     month=5,
                                                     day=10,
                                                     hour=20,
                                                     minute=23,
                                                     second=00,
                                                     microsecond=182371),
            data_finish_competition=datetime.datetime(year=2024,
                                                      month=5,
                                                      day=31,
                                                      hour=21,
                                                      minute=16,
                                                      second=00,
                                                      microsecond=182371),
        )
        comp.categories.add(cats[1])
        comp.categories.add(cats[3])
        comp.categories.add(cats[4])
        comp.categories.add(cats[5])
        comp.save()

        team = Team.objects.create(name='Lethal')
        team.members.add(self.USERS['Doasy'])
        team.members.add(self.USERS['latra'])
        team.members.add(self.USERS['Marta99'])
        team.competition = comp
        team.ranking = Ranking.objects.create(score=120).save()
        team.submition = Submit.objects.create(
            description='Submition of Lethal',
            githuburl='https://github.com/Oriolac/codeleague/',
            submit_date=datetime.datetime(year=2023,
                                          month=10,
                                          day=7,
                                          hour=19,
                                          minute=30,
                                          second=00,
                                          microsecond=182371),
            team_id=team.id)
        team.save()

        team = Team.objects.create(name='PHPHaters')
        team.members.add(self.USERS['horno'])
        team.members.add(self.USERS['quimpm'])
        team.members.add(self.USERS['Oriolac'])
        team.members.add(self.USERS['notaiax'])
        team.competition = comp
        team.ranking = Ranking.objects.create(score=140).save()
        team.submition = Submit.objects.create(
            description='Submition of PHPHaters',
            githuburl='https://github.com/Oriolac/codeleague/',
            submit_date=datetime.datetime(year=2023,
                                          month=5,
                                          day=20,
                                          hour=22,
                                          minute=30,
                                          second=00,
                                          microsecond=182371),
            team_id=team.id)
        team.save()

        comp = Competition.objects.create(
            title='II Deep Learning League',
            description=
            'LleidaHack has creted the second Deep Learning League. You can '
            'join the league before competition starts.',
            owner=admin,
            data_start_inscription=datetime.datetime(year=2018,
                                                     month=4,
                                                     day=10,
                                                     hour=11,
                                                     minute=55,
                                                     second=00,
                                                     microsecond=182371),
            data_finish_inscription=datetime.datetime(year=2023,
                                                      month=5,
                                                      day=11,
                                                      hour=11,
                                                      minute=12,
                                                      second=00,
                                                      microsecond=182371),
            data_start_competition=datetime.datetime(year=2020,
                                                     month=5,
                                                     day=15,
                                                     hour=20,
                                                     minute=30,
                                                     second=00,
                                                     microsecond=182371),
            data_finish_competition=datetime.datetime(year=2025,
                                                      month=5,
                                                      day=31,
                                                      hour=20,
                                                      minute=30,
                                                      second=00,
                                                      microsecond=182371),
        )
        comp.categories.add(cats[1])
        comp.categories.add(cats[3])
        comp.categories.add(cats[4])
        comp.categories.add(cats[5])
        comp.save()

        team = Team.objects.create(name='Aniquilators')
        team.members.add(self.USERS['horno'])
        team.members.add(self.USERS['quimpm'])
        team.members.add(self.USERS['Oriolac'])
        team.members.add(self.USERS['sergisi'])
        team.competition = comp
        team.ranking = Ranking.objects.create(score=150).save()
        team.submition = Submit.objects.create(
            description='Submition of Aniquilators',
            githuburl='https://github.com/Oriolac/codeleague/',
            submit_date=datetime.datetime(year=2020,
                                          month=5,
                                          day=17,
                                          hour=22,
                                          minute=30,
                                          second=00,
                                          microsecond=182371),
            team_id=team.id)
        team.save()

        team = Team.objects.create(name='Dominators')
        team.members.add(self.USERS['Doasy'])
        team.members.add(self.USERS['latra'])
        team.members.add(self.USERS['pau1838'])
        team.competition = comp
        team.ranking = Ranking.objects.create(score=170).save()
        team.submition = Submit.objects.create(
            description='Submition of Dominators',
            githuburl='https://github.com/Oriolac/codeleague/',
            submit_date=datetime.datetime(year=2020,
                                          month=5,
                                          day=20,
                                          hour=23,
                                          minute=45,
                                          second=00,
                                          microsecond=182371),
            team_id=team.id)
        team.save()

        comp = Competition.objects.create(
            title='I Data Jam',
            description=
            'Data Jam is a competition where the teams have to develop '
            'programs to solve some high-complex problems. Are you '
            'prepared?',
            owner=admin,
            data_start_inscription=datetime.datetime(year=2016,
                                                     month=3,
                                                     day=19,
                                                     hour=11,
                                                     minute=55,
                                                     second=00,
                                                     microsecond=182371),
            data_finish_inscription=datetime.datetime(year=2018,
                                                      month=4,
                                                      day=20,
                                                      hour=11,
                                                      minute=12,
                                                      second=00,
                                                      microsecond=182371),
            data_start_competition=datetime.datetime(year=2018,
                                                     month=5,
                                                     day=10,
                                                     hour=20,
                                                     minute=23,
                                                     second=00,
                                                     microsecond=182371),
            data_finish_competition=datetime.datetime(year=2029,
                                                      month=5,
                                                      day=31,
                                                      hour=21,
                                                      minute=16,
                                                      second=00,
                                                      microsecond=182371),
        )
        comp.categories.add(cats[6])
        comp.save()

        team = Team.objects.create(name='Code Warriors')
        team.members.add(self.USERS['horno'])
        team.members.add(self.USERS['pau1838'])
        team.members.add(self.USERS['Oriolac'])
        team.competition = comp
        team.ranking = Ranking.objects.create(score=90).save()
        team.submition = Submit.objects.create(
            description='Submition of Code Warriors',
            githuburl='https://github.com/Oriolac/codeleague/',
            submit_date=datetime.datetime(year=2023,
                                          month=7,
                                          day=1,
                                          hour=12,
                                          minute=30,
                                          second=00,
                                          microsecond=182371),
            team_id=team.id)
        team.save()

        team = Team.objects.create(name='The Bytes')
        team.members.add(self.USERS['Marta99'])
        team.members.add(self.USERS['latra'])
        team.members.add(self.USERS['quimpm'])
        team.members.add(self.USERS['notaiax'])
        team.competition = comp
        team.ranking = Ranking.objects.create(score=110).save()
        team.submition = Submit.objects.create(
            description='Submition of The Bytes',
            githuburl='https://github.com/Oriolac/codeleague/',
            submit_date=datetime.datetime(year=2023,
                                          month=5,
                                          day=20,
                                          hour=22,
                                          minute=30,
                                          second=00,
                                          microsecond=182371),
            team_id=team.id)
        team.save()

        team = Team.objects.create(name='Veterans')
        team.members.add(self.USERS['Doasy'])
        team.members.add(self.USERS['sergisi'])
        team.competition = comp
        team.ranking = Ranking.objects.create(score=100).save()
        team.submition = Submit.objects.create(
            description='Submition of Veterans',
            githuburl='https://github.com/Oriolac/codeleague/',
            submit_date=datetime.datetime(year=2025,
                                          month=6,
                                          day=12,
                                          hour=22,
                                          minute=30,
                                          second=00,
                                          microsecond=182371),
            team_id=team.id)
        team.save()

        comp = Competition.objects.create(
            title='II Data Jam',
            description=
            'Data Jam is a competition where the teams have to develop '
            'programs to solve some high-complex problems. Are you '
            'prepared?',
            owner=admin,
            data_start_inscription=datetime.datetime(year=2017,
                                                     month=3,
                                                     day=19,
                                                     hour=11,
                                                     minute=55,
                                                     second=00,
                                                     microsecond=182371),
            data_finish_inscription=datetime.datetime(year=2023,
                                                      month=4,
                                                      day=20,
                                                      hour=11,
                                                      minute=12,
                                                      second=00,
                                                      microsecond=182371),
            data_start_competition=datetime.datetime(year=2019,
                                                     month=5,
                                                     day=10,
                                                     hour=20,
                                                     minute=23,
                                                     second=00,
                                                     microsecond=182371),
            data_finish_competition=datetime.datetime(year=2024,
                                                      month=5,
                                                      day=31,
                                                      hour=21,
                                                      minute=16,
                                                      second=00,
                                                      microsecond=182371),
        )
        comp.categories.add(cats[6])
        comp.save()

        team = Team.objects.create(name='Your Worst Nightmare')
        team.members.add(self.USERS['sergisi'])
        team.members.add(self.USERS['latra'])
        team.members.add(self.USERS['Oriolac'])
        team.members.add(self.USERS['pau1838'])
        team.competition = comp
        team.ranking = Ranking.objects.create(score=90).save()
        team.submition = Submit.objects.create(
            description='Submition of Your Worst Nightmare',
            githuburl='https://github.com/Oriolac/codeleague/',
            submit_date=datetime.datetime(year=2020,
                                          month=5,
                                          day=25,
                                          hour=15,
                                          minute=00,
                                          second=00,
                                          microsecond=182371),
            team_id=team.id)
        team.save()

        team = Team.objects.create(name='Challengers')
        team.members.add(self.USERS['Marta99'])
        team.members.add(self.USERS['horno'])
        team.members.add(self.USERS['notaiax'])
        team.competition = comp
        team.ranking = Ranking.objects.create(score=85).save()
        team.submition = Submit.objects.create(
            description='Submition of Challengers',
            githuburl='https://github.com/Oriolac/codeleague/',
            submit_date=datetime.datetime(year=2020,
                                          month=4,
                                          day=9,
                                          hour=17,
                                          minute=00,
                                          second=00,
                                          microsecond=182371),
            team_id=team.id)
        team.save()

        comp = Competition.objects.create(
            title='III Data Jam',
            description=
            'Data Jam is a competition where the teams have to develop '
            'programs to solve some high-complex problems. Are you '
            'prepared? Here it comes the 3rd edition!',
            owner=admin,
            data_start_inscription=datetime.datetime(year=2017,
                                                     month=3,
                                                     day=19,
                                                     hour=11,
                                                     minute=55,
                                                     second=00,
                                                     microsecond=182371),
            data_finish_inscription=datetime.datetime(year=2023,
                                                      month=4,
                                                      day=20,
                                                      hour=11,
                                                      minute=12,
                                                      second=00,
                                                      microsecond=182371),
            data_start_competition=datetime.datetime(year=2019,
                                                     month=5,
                                                     day=10,
                                                     hour=20,
                                                     minute=23,
                                                     second=00,
                                                     microsecond=182371),
            data_finish_competition=datetime.datetime(year=2024,
                                                      month=5,
                                                      day=31,
                                                      hour=21,
                                                      minute=16,
                                                      second=00,
                                                      microsecond=182371),
        )
        comp.categories.add(cats[6])
        comp.save()

        team = Team.objects.create(name='Unbeatables')
        team.members.add(self.USERS['sergisi'])
        team.members.add(self.USERS['Oriolac'])
        team.members.add(self.USERS['Doasy'])
        team.competition = comp
        team.ranking = Ranking.objects.create(score=85).save()
        team.submition = Submit.objects.create(
            description='Submition of Unbeatables',
            githuburl='https://github.com/Oriolac/codeleague/',
            submit_date=datetime.datetime(year=2024,
                                          month=2,
                                          day=9,
                                          hour=21,
                                          minute=35,
                                          second=00,
                                          microsecond=182371),
            team_id=team.id)
        team.save()

        comp = Competition.objects.create(
            title='I Cybersecurity League',
            description=
            'For lovers of computer security, here it comes the first '
            'edition of the Cybersecurity League',
            owner=admin,
            data_start_inscription=datetime.datetime(year=2019,
                                                     month=8,
                                                     day=20,
                                                     hour=11,
                                                     minute=30,
                                                     second=00,
                                                     microsecond=182371),
            data_finish_inscription=datetime.datetime(year=2022,
                                                      month=9,
                                                      day=20,
                                                      hour=11,
                                                      minute=15,
                                                      second=00,
                                                      microsecond=182371),
            data_start_competition=datetime.datetime(year=2022,
                                                     month=8,
                                                     day=21,
                                                     hour=20,
                                                     minute=00,
                                                     second=00,
                                                     microsecond=182371),
            data_finish_competition=datetime.datetime(year=2030,
                                                      month=8,
                                                      day=25,
                                                      hour=20,
                                                      minute=00,
                                                      second=00,
                                                      microsecond=182371),
        )
        comp.categories.add(cats[0])
        comp.save()

        team = Team.objects.create(name='Cyberfighters')
        team.members.add(self.USERS['latra'])
        team.members.add(self.USERS['notaiax'])
        team.members.add(self.USERS['horno'])
        team.competition = comp
        team.ranking = Ranking.objects.create(score=95).save()
        team.submition = Submit.objects.create(
            description='Submition of Cyberfighters',
            githuburl='https://github.com/Oriolac/codeleague/',
            submit_date=datetime.datetime(year=2022,
                                          month=8,
                                          day=22,
                                          hour=17,
                                          minute=00,
                                          second=00,
                                          microsecond=182371),
            team_id=team.id)
        team.save()

        team = Team.objects.create(name='Cyber Kings')
        team.members.add(self.USERS['Marta99'])
        team.members.add(self.USERS['Oriolac'])
        team.competition = comp
        team.ranking = Ranking.objects.create(score=70).save()
        team.submition = Submit.objects.create(
            description='Submition of Cyber Kings',
            githuburl='https://github.com/Oriolac/codeleague/',
            submit_date=datetime.datetime(year=2022,
                                          month=8,
                                          day=24,
                                          hour=19,
                                          minute=00,
                                          second=00,
                                          microsecond=182371),
            team_id=team.id)
        team.save()

        comp = Competition.objects.create(
            title='II Cybersecurity League',
            description=
            'For lovers of computer security, and as the first edition was '
            'so successful. Here it comes the second edition of the '
            'Cybersecurity League',
            owner=admin,
            data_start_inscription=datetime.datetime(year=2017,
                                                     month=3,
                                                     day=19,
                                                     hour=11,
                                                     minute=55,
                                                     second=00,
                                                     microsecond=182371),
            data_finish_inscription=datetime.datetime(year=2023,
                                                      month=4,
                                                      day=20,
                                                      hour=11,
                                                      minute=12,
                                                      second=00,
                                                      microsecond=182371),
            data_start_competition=datetime.datetime(year=2019,
                                                     month=5,
                                                     day=10,
                                                     hour=20,
                                                     minute=23,
                                                     second=00,
                                                     microsecond=182371),
            data_finish_competition=datetime.datetime(year=2024,
                                                      month=5,
                                                      day=31,
                                                      hour=21,
                                                      minute=16,
                                                      second=00,
                                                      microsecond=182371),
        )
        comp.categories.add(cats[0])
        comp.save()

        team = Team.objects.create(name='Tech Divas')
        team.members.add(self.USERS['latra'])
        team.members.add(self.USERS['Doasy'])
        team.members.add(self.USERS['Marta99'])
        team.competition = comp
        team.ranking = Ranking.objects.create(score=100).save()
        team.submition = Submit.objects.create(
            description='Submition of Tech Divas',
            githuburl='https://github.com/Oriolac/codeleague/',
            submit_date=datetime.datetime(year=2022,
                                          month=8,
                                          day=25,
                                          hour=12,
                                          minute=30,
                                          second=00,
                                          microsecond=182371),
            team_id=team.id)
        team.save()

        team = Team.objects.create(name='Cyberlovers')
        team.members.add(self.USERS['pau1838'])
        team.members.add(self.USERS['notaiax'])
        team.competition = comp
        team.ranking = Ranking.objects.create(score=85).save()
        team.submition = Submit.objects.create(
            description='Submition of Cyberlovers',
            githuburl='https://github.com/Oriolac/codeleague/',
            submit_date=datetime.datetime(year=2023,
                                          month=5,
                                          day=14,
                                          hour=11,
                                          minute=00,
                                          second=00,
                                          microsecond=182371),
            team_id=team.id)
        team.save()

        team = Team.objects.create(name='Workaholics')
        team.members.add(self.USERS['sergisi'])
        team.members.add(self.USERS['Oriolac'])
        team.competition = comp
        team.ranking = Ranking.objects.create(score=100).save()
        team.submition = Submit.objects.create(
            description='Submition of Workaholics',
            githuburl='https://github.com/Oriolac/codeleague/',
            submit_date=datetime.datetime(year=2020,
                                          month=11,
                                          day=29,
                                          hour=23,
                                          minute=00,
                                          second=00,
                                          microsecond=182371),
            team_id=team.id)
        team.save()

        team = Team.objects.create(name='Code Squad')
        team.members.add(self.USERS['quimpm'])
        team.members.add(self.USERS['horno'])
        team.competition = comp
        team.ranking = Ranking.objects.create(score=85).save()
        team.submition = Submit.objects.create(
            description='Submition of CodeSquad',
            githuburl='https://github.com/Oriolac/codeleague/',
            submit_date=datetime.datetime(year=2022,
                                          month=6,
                                          day=22,
                                          hour=20,
                                          minute=30,
                                          second=00,
                                          microsecond=182371),
            team_id=team.id)
        team.save()

        comp = Competition.objects.create(
            title='I SATSolver Race',
            description=
            'For the first time, here it comes the first SATSolver Race! '
            'Will you be the fastest solver?',
            owner=admin,
            data_start_inscription=datetime.datetime(year=2017,
                                                     month=3,
                                                     day=19,
                                                     hour=11,
                                                     minute=55,
                                                     second=00,
                                                     microsecond=182371),
            data_finish_inscription=datetime.datetime(year=2023,
                                                      month=4,
                                                      day=20,
                                                      hour=11,
                                                      minute=12,
                                                      second=00,
                                                      microsecond=182371),
            data_start_competition=datetime.datetime(year=2019,
                                                     month=5,
                                                     day=10,
                                                     hour=20,
                                                     minute=23,
                                                     second=00,
                                                     microsecond=182371),
            data_finish_competition=datetime.datetime(year=2024,
                                                      month=5,
                                                      day=31,
                                                      hour=21,
                                                      minute=16,
                                                      second=00,
                                                      microsecond=182371),
        )
        comp.categories.add(cats[6])
        comp.save()

        team = Team.objects.create(name='estresSAT')
        team.members.add(self.USERS['latra'])
        team.members.add(self.USERS['Oriolac'])
        team.members.add(self.USERS['Marta99'])
        team.members.add(self.USERS['Doasy'])
        team.competition = comp
        team.ranking = Ranking.objects.create(score=100).save()
        team.submition = Submit.objects.create(
            description='Submition of estreSAT Solver',
            githuburl='https://github.com/Oriolac/codeleague/',
            submit_date=datetime.datetime(year=2019,
                                          month=9,
                                          day=10,
                                          hour=20,
                                          minute=23,
                                          second=00,
                                          microsecond=182371),
            team_id=team.id)
        team.save()

        team = Team.objects.create(name='fracaSAT')
        team.members.add(self.USERS['sergisi'])
        team.members.add(self.USERS['horno'])
        team.members.add(self.USERS['notaiax'])
        team.competition = comp
        team.ranking = Ranking.objects.create(score=80).save()
        team.submition = Submit.objects.create(
            description='Submition of fracaSAT Solver',
            githuburl='https://github.com/Oriolac/codeleague/',
            submit_date=datetime.datetime(year=2021,
                                          month=5,
                                          day=10,
                                          hour=15,
                                          minute=23,
                                          second=00,
                                          microsecond=182371),
            team_id=team.id)
        team.save()

        team = Team.objects.create(name='The Best SAT')
        team.members.add(self.USERS['pau1838'])
        team.members.add(self.USERS['quimpm'])
        team.competition = comp
        team.ranking = Ranking.objects.create(score=75).save()
        team.submition = Submit.objects.create(
            description='Submition of The Best SAT Solver',
            githuburl='https://github.com/Oriolac/codeleague/',
            submit_date=datetime.datetime(year=2021,
                                          month=4,
                                          day=22,
                                          hour=20,
                                          minute=30,
                                          second=00,
                                          microsecond=182371),
            team_id=team.id)
        team.save()
Example #10
0
import random
import sys
import uuid
import os

from django.db.models.functions import datetime

# Get the list of arguments
argument_list = (sys.argv)

# Create and open new data file to write to
file_path = '../website/apps/home/data/'
if argument_list[1]:
    file_name = argument_list[1]
else:
    file_name = str(datetime.datetime())
file_to_open = file_path + file_name + '.csv'
data_file = open(file_to_open, 'w')

# Write the header line
data_file.write(
    "name,output_generate_date,value_mid,value_high,disease,model_name,department,"
    "municipality_code,municipality,department_code,date,value_low,id,population\n"
)

# Open the department and municipality file:
dept_mun_file = open('all_department_municipalities_colombia.csv', 'r')
department_municipality_list = []
for dept_mun in dept_mun_file:
    dept_and_municipality = []
    dm = dept_mun.strip('\n').split(",")
Example #11
0
import random
import sys
import uuid
import os

from django.db.models.functions import datetime

# Get the list of arguments
argument_list = (sys.argv)

# Create and open new data file to write to
file_path = '../website/apps/home/data/'
if argument_list[1]:
    file_name = argument_list[1]
else:
    file_name = str(datetime.datetime())
file_to_open = file_path + file_name + '.csv'
data_file = open(file_to_open, 'w')

# Write the header line
data_file.write("name,output_generate_date,value_mid,value_high,disease,model_name,department,"
                "municipality_code,municipality,department_code,date,value_low,id,population\n")

# Open the department and municipality file:
dept_mun_file = open('all_department_municipalities_colombia.csv', 'r')
department_municipality_list = []
for dept_mun in dept_mun_file:
    dept_and_municipality = []
    dm = dept_mun.strip('\n').split(",")
    department_municipality_list.append(dm)