Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CHG cut report in half by only listing courses once #303

Merged
merged 1 commit into from
Nov 7, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 24 additions & 21 deletions api/jobs/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,27 +79,17 @@ def get_course_theia_session_count(course) -> int:
def generate_report() -> str:
"""
Generate a report of the statuses of Anubis. The statuses are:
Course names and code
Number of active users this semester
Number of IDEs opened this semester
Number of students for each course
Number of IDES opened for each course
Course names and code
Number of students for each course
Number of IDES opened for each course
Number of active users this semester
Number of IDEs opened this semester

:return: The text of the report
"""

# Course List
courses = get_courses()
data = [[course.name, course.course_code] for course in courses]
report = tabulate(data, headers=["Course Name", "Course Code"])

# Number of users enrolled in at least on class this semester
report += "\n\nTotal users enrolled in at least one course this semester\n"
report += f"{get_active_users_this_semester()}\n"

# Number of IDEs opened this semester
report += "\nTotal IDEs opened this semseter\n"
report += f"{get_ides_opened_this_semester()}\n\n"

# Number of students, IDEs for each course
data = [
Expand All @@ -111,10 +101,19 @@ def generate_report() -> str:
]
for course in courses
]
report += tabulate(
data, headers=["Course Name", "Course Code", "Users enrolled", "IDES opened"]

report = tabulate(
data, headers=["Course Name", "Course Code", "Users", "IDEs opened"]
)

# Number of users enrolled in at least one class this semester
report += "\n\nTotal users enrolled in at least one course this semester\n"
report += f"{get_active_users_this_semester()}"

# Number of IDEs opened this semester
report += "\n\nTotal IDEs opened this semseter\n"
report += f"{get_ides_opened_this_semester()}"

return report


Expand Down Expand Up @@ -142,8 +141,8 @@ async def contribute(ctx, *args):

:return:
"""
desc = "Thanks for your interest in contributing to Anubis! We're always looking for new people to help "
desc += "make Anubis even better. Please head to [our GitHub repo](https://github.com/anubislms/Anubis)."
desc = "Thanks for your interest in contributing to Anubis! We're always looking for new people to help"
desc += " make Anubis even better. Please head to [our GitHub repo](https://github.com/anubislms/Anubis)."
emb = discord.Embed(
title="Contributing to Anubis",
description=desc,
Expand All @@ -158,9 +157,13 @@ async def helpCommand(ctx, *args):

:return:
"""
emb = discord.Embed(title="Anubis Bot Help", description="")
emb = discord.Embed(title="Anubis Bot Help", description="").set_thumbnail(
url=bot.user.avatar_url
)
for command in bot.commands:
emb.add_field(name=command.name, value=command.help, inline=True)
emb.add_field(
name=bot.command_prefix + command.name, value=command.help, inline=True
)
await ctx.send(embed=emb)


Expand Down