Update app.py
Browse files
app.py
CHANGED
@@ -8,13 +8,13 @@ def calculate_attendance(total_days, absent_hours):
|
|
8 |
present_percentage = (present_hours / total_hours) * 100
|
9 |
|
10 |
if present_percentage >= 74:
|
11 |
-
exam_status = "Eligible to write the exam"
|
12 |
elif 65 <= present_percentage <= 75:
|
13 |
-
exam_status = "Should pay fine to write the exam"
|
14 |
elif 50 <= present_percentage < 65:
|
15 |
-
exam_status = "
|
16 |
else:
|
17 |
-
exam_status = "Redo"
|
18 |
|
19 |
# Round to two decimal places
|
20 |
present_percentage = round(present_percentage, 2)
|
@@ -43,7 +43,7 @@ st.markdown("""
|
|
43 |
</style>
|
44 |
""", unsafe_allow_html=True)
|
45 |
|
46 |
-
st.
|
47 |
st.markdown("______")
|
48 |
|
49 |
with st.container():
|
@@ -64,13 +64,16 @@ if st.session_state.calculator_mode == "normal":
|
|
64 |
total_days = st.number_input("Total Working Days", min_value=1, max_value=365, value=5)
|
65 |
with col2:
|
66 |
absent_hours = st.number_input("Absent Hours of the Student", min_value=0, step=1)
|
67 |
-
|
68 |
if st.button("Calculate Attendance"):
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
|
|
|
|
|
|
74 |
|
75 |
elif st.session_state.calculator_mode == "excel":
|
76 |
st.subheader("Upload an Excel or CSV File")
|
@@ -142,3 +145,28 @@ elif st.session_state.calculator_mode == "excel":
|
|
142 |
)
|
143 |
except Exception as e:
|
144 |
st.error(f"β οΈ Error processing file: {e}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
present_percentage = (present_hours / total_hours) * 100
|
9 |
|
10 |
if present_percentage >= 74:
|
11 |
+
exam_status = "π’ Eligible to write the exam"
|
12 |
elif 65 <= present_percentage <= 75:
|
13 |
+
exam_status = "π‘ Should pay fine to write the exam"
|
14 |
elif 50 <= present_percentage < 65:
|
15 |
+
exam_status = "π΄ Arrear "
|
16 |
else:
|
17 |
+
exam_status = "β« Redo"
|
18 |
|
19 |
# Round to two decimal places
|
20 |
present_percentage = round(present_percentage, 2)
|
|
|
43 |
</style>
|
44 |
""", unsafe_allow_html=True)
|
45 |
|
46 |
+
st.subheader("Student Attendance Calculator")
|
47 |
st.markdown("______")
|
48 |
|
49 |
with st.container():
|
|
|
64 |
total_days = st.number_input("Total Working Days", min_value=1, max_value=365, value=5)
|
65 |
with col2:
|
66 |
absent_hours = st.number_input("Absent Hours of the Student", min_value=0, step=1)
|
67 |
+
|
68 |
if st.button("Calculate Attendance"):
|
69 |
+
if absent_hours > total_days*5:
|
70 |
+
st.write("Enter valid Absent Hours!")
|
71 |
+
else:
|
72 |
+
present_percentage, present_hours, exam_status = calculate_attendance(total_days, absent_hours)
|
73 |
+
|
74 |
+
st.write(f"**Present Percentage**: {present_percentage:.2f}%")
|
75 |
+
st.write(f"**Present Hours**: {present_hours}")
|
76 |
+
st.write(f"**Exam Status**: {exam_status}")
|
77 |
|
78 |
elif st.session_state.calculator_mode == "excel":
|
79 |
st.subheader("Upload an Excel or CSV File")
|
|
|
145 |
)
|
146 |
except Exception as e:
|
147 |
st.error(f"β οΈ Error processing file: {e}")
|
148 |
+
|
149 |
+
# Footer
|
150 |
+
st.write(" ")
|
151 |
+
st.write(" ")
|
152 |
+
st.write(" ")
|
153 |
+
footer_html = """
|
154 |
+
<style>
|
155 |
+
.footer {
|
156 |
+
position: fixed;
|
157 |
+
bottom: 0;
|
158 |
+
left: 0;
|
159 |
+
width: 100%;
|
160 |
+
background-color: #E7EBF3;
|
161 |
+
text-align: center;
|
162 |
+
padding: 10px;
|
163 |
+
font-size: 14px;
|
164 |
+
color: #333;
|
165 |
+
}
|
166 |
+
</style>
|
167 |
+
<div class="footer">
|
168 |
+
Made By balafromtn π
|
169 |
+
</div>
|
170 |
+
"""
|
171 |
+
|
172 |
+
st.markdown(footer_html, unsafe_allow_html=True)
|