Skip to content

Commit

Permalink
fix: removing reminders functions from the application
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAveron committed Sep 1, 2024
1 parent 412a5eb commit 8faf4a3
Show file tree
Hide file tree
Showing 18 changed files with 15 additions and 457 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,5 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

reminders_future/
31 changes: 4 additions & 27 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,23 @@
from dotenv import load_dotenv
from flask import (Flask, flash, jsonify, redirect, render_template, request,
url_for)
from flask_socketio import SocketIO
from werkzeug import Response

from modules import (add_reminder, fetch_tle_data, get_current_position,
from modules import ( fetch_tle_data, get_current_position,
get_future_positions, get_iss_crew, get_iss_info,
get_logged_in_user, get_next_passes, init_db, login_user,
logout_user, register_user, start_reminder_checker,
logout_user, register_user,
verify_user)

# Load environment variables
load_dotenv()

# Flask app and SocketIO initialization
# Flask app initialization
app = Flask(__name__)
app.secret_key = os.getenv("TOKEN")
socketio = SocketIO(app)

# Initialize database and start background processes
init_db()
start_reminder_checker()
TLE = fetch_tle_data()


Expand Down Expand Up @@ -164,25 +161,5 @@ def next_passes() -> Tuple[Response, int]:
passes = get_next_passes(TLE, lat, lon, num_passes=3)
return jsonify(passes), 200


@app.route("/add-reminder", methods=["POST"])
def add_reminder_route() -> Tuple[Response, int]:
"""
Adds a reminder for a specific ISS pass time.
Returns:
Tuple[Response, int]: JSON response with status and HTTP status code.
"""
user_id = request.form["user_id"]
pass_time_str = request.form["pass_time"] # ISO format: '2024-08-30T10:15:00Z'

# Convert ISO 8601 string to datetime object
pass_time = datetime.fromisoformat(pass_time_str.rstrip("Z"))

add_reminder(user_id, pass_time)
return jsonify({"status": "success"}), 200


if __name__ == "__main__":
app.run(debug=False)
socketio.run(app)
app.run(debug=False)
Binary file modified database.db
Binary file not shown.
3 changes: 1 addition & 2 deletions modules/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from .database import *
from .iss_info import *
from .iss_tracker import *
from .reminder_service import *
from .tle_fetcher import *
from .user_service import *
from .user_service import *
14 changes: 1 addition & 13 deletions modules/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,11 @@ def init_db() -> None:
"""
Initializes the database by creating the necessary tables if they do not exist.
This function creates the `iss_reminders` and `users` tables if they are not already present.
This function creates the `users` table if it's not already present.
"""
with sqlite3.connect(DATABASE_FILE) as conn:
cursor = conn.cursor()

# Create iss_reminders table
cursor.execute(
"""
CREATE TABLE IF NOT EXISTS iss_reminders (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER,
pass_time DATETIME,
notified BOOLEAN DEFAULT 0
)
"""
)

# Create users table
cursor.execute(
"""
Expand Down
80 changes: 0 additions & 80 deletions modules/reminder_service.py

This file was deleted.

36 changes: 0 additions & 36 deletions predict_trajectory.py

This file was deleted.

5 changes: 0 additions & 5 deletions static/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
* {
margin: 0;
padding: 0;
}

body,
html {
/* height: 100vh; */
font-family: 'Roboto', sans-serif;
}

Expand Down
File renamed without changes.
13 changes: 0 additions & 13 deletions static/css/layout.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,6 @@ header {
place-items: center;
}

#map {
height: 92vh;
width: 100vw;
}

.leaflet-left {
left: 10px;
}

.leaflet-top {
top: 15vh;
}

.navbar {
display: flex;
flex-direction: row;
Expand Down
File renamed without changes.
Loading

0 comments on commit 8faf4a3

Please sign in to comment.