diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml new file mode 100644 index 0000000..52e4245 --- /dev/null +++ b/.github/workflows/sonarqube.yml @@ -0,0 +1,28 @@ +name: Sonarqube + +on: + push: + branches: + - main + pull_request: + + +jobs: + build: + name: Build and analyze + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.13' + + - uses: SonarSource/sonarqube-scan-action@v6 + env: + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }} \ No newline at end of file diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 0000000..995bea0 --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1 @@ +sonar.projectKey=jumpstart-v2 \ No newline at end of file diff --git a/src/core/google.py b/src/core/google.py index 1caf494..f2903d7 100644 --- a/src/core/google.py +++ b/src/core/google.py @@ -1,3 +1,48 @@ ''' Eli Mares +''' + +''' +def calendar(): + # Call the Calendar API + now = datetime.now(timezone.utc or pytz.utc) + events_result = calendar_service.events().list( + calendarId='rti648k5hv7j3ae3a3rum8potk@group.calendar.google.com', + timeMin=now.isoformat(), + maxResults=10, + singleEvents=True, + orderBy='startTime', + ).execute() + events = events_result.get('items', []) + + final_events = "
" + + if not events: + print('No upcoming events found.') + for event in events: + start = event['start'].get('dateTime', event['start'].get('date')) + fin_date = parser.parse(start) + try: + delta = fin_date - now + except: + d = datetime.utcnow() + delta = fin_date - d + + formatted = format_timedelta(delta) if delta > timedelta(0) else "------" + + final_events += ( + """
""" + + formatted + + """
""" + ) + final_events += ( + ""+ + ''.join(event['summary'])+ + "
" + ) + final_events += "
" + + event_list = {'data': final_events} + return jsonify(event_list) + ''' \ No newline at end of file