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

Fetch notifications #20

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Conversation

PavanTeja2005
Copy link
Contributor

@PavanTeja2005 PavanTeja2005 commented Oct 8, 2024

Fix #19
I have added the notification fetching function "get_notification"

If _from and _to are given the notifications are fetched.
If only _from is given, from that date notifications are fetched
If none is given, previous 30 days notification are fetched

@cro2003
Copy link
Owner

cro2003 commented Oct 8, 2024

On my end its showing []

@PavanTeja2005
Copy link
Contributor Author

It's because there are no notifications in the last 30 days. I have checked the site.

You can try using _from and _to..

@cro2003
Copy link
Owner

cro2003 commented Oct 8, 2024

I see, as these are archived notices. So what you can do is that if there's no date is passed in argument just give all the important alerts which is showed in the pop when we open rgpv homepage + archived notice if its within one month range. If dates are passed and there are no notifications just give all the important alerts which is showed in the pop when we open rgpv homepage, here remember there can be case like i passed 01-08-2024 & 02-8-2024 there are notification between them but after these dates archived notifications are available in this case it shoud return []. In a bit i will be sharing some examples which will show how it should work.

@cro2003
Copy link
Owner

cro2003 commented Oct 8, 2024

Example 1: No Arguments
Show all the Notification which are in the homepage of rgpv + archived notification which are within 1 month time, for instance today is 08-10-2024, check for the notification which are after 08-09-2024 in the archived notification.
image

@cro2003
Copy link
Owner

cro2003 commented Oct 8, 2024

Example 2: Argument Passed (_from: 01-09-2024, _to: 10-09-2024)
Show Notification from 01-09-2024 in archived notification + All the notifications from the Homepage (as after 04-09-2024 there are no archived notification but new notifications can be there as the _to date is 10-09-2024)
image
image

@cro2003
Copy link
Owner

cro2003 commented Oct 8, 2024

Example 3: Argument Passed (_from: 10-09-2024, _to: 01-10-2024)
There are no notification from 10-09-2024 in archived notification, the latest notification was on 04-09-2024. So now in this case we can directly show the notification from the homepage
image

@PavanTeja2005
Copy link
Contributor Author

There is no date data available. but is this okay?
image

@PavanTeja2005
Copy link
Contributor Author

Archived case is fine, but it doesn't have any date info.

@cro2003
Copy link
Owner

cro2003 commented Oct 8, 2024

Yea its cool but just add a key of date and write the value as "NOT AVAILABLE", "date": "NOT AVAILABLE"

@cro2003
Copy link
Owner

cro2003 commented Oct 8, 2024

Also please make sure all the notification have the links to it (even with archived notification) as without link they will be useless.

@cro2003
Copy link
Owner

cro2003 commented Oct 8, 2024

Example 4: Argument Passed (_from: 01-09-2024, _to: 03-09-2024)
In this Case there are no notification in the archived between the given dates, also we dont have to give the all notification from the homepage as the latest archived notification is after the _to date.
Output: []

@cro2003
Copy link
Owner

cro2003 commented Oct 8, 2024

Example 5: Argument Passed (_from: 01-08-2024, _to: 01-09-2024)
As we can see that there are archived notification between these days so we only have to show that notifications, we dont have to give the all notification from the homepage as the latest archived notification is after the _to date.
image

@cro2003
Copy link
Owner

cro2003 commented Oct 8, 2024

Also add this functionality in info_api.py instead of result_api.py

@PavanTeja2005
Copy link
Contributor Author

Check the new codes

Output:
image

@cro2003
Copy link
Owner

cro2003 commented Oct 8, 2024

Can you please share the Output of the all 5 Examples which i have given above

@PavanTeja2005
Copy link
Contributor Author

Example 1: No Arguments
Show all the Notification which are in the homepage of rgpv + archived notification which are within 1 month time, for instance today is 08-10-2024, check for the notification which are after 08-09-2024 in the archived notification.

image

@PavanTeja2005
Copy link
Contributor Author

Example 2: Argument Passed (_from: 01-09-2024, _to: 10-09-2024)
Show Notification from 01-09-2024 in archived notification + All the notifications from the Homepage (as after 04-09-2024 there are no archived notification but new notifications can be there as the _to date is 10-09-2024)

image

@PavanTeja2005
Copy link
Contributor Author

Example 3: Argument Passed (_from: 10-09-2024, _to: 01-10-2024)
There are no notification from 10-09-2024 in archived notification, the latest notification was on 04-09-2024. So now in this case we can directly show the notification from the homepage
Start
image
end
image

@PavanTeja2005
Copy link
Contributor Author

Example 4: Argument Passed (_from: 01-09-2024, _to: 03-09-2024)
In this Case there are no notification in the archived between the given dates, also we dont have to give the all notification from the homepage as the latest archived notification is after the _to date.
Output: []

image

@PavanTeja2005
Copy link
Contributor Author

Example 5: Argument Passed (_from: 01-08-2024, _to: 01-09-2024)
As we can see that there are archived notification between these days so we only have to show that notifications, we dont have to give the all notification from the homepage as the latest archived notification is after the _to date.
image

image

@PavanTeja2005
Copy link
Contributor Author

What should I do with the archived notifications? As it's using js we cannot use requests. Using selenium will increase the project's complexity.

@PavanTeja2005
Copy link
Contributor Author

I meant the links in the archived notifications.

@cro2003
Copy link
Owner

cro2003 commented Oct 9, 2024

I see, let me check what be done here.

@PavanTeja2005
Copy link
Contributor Author

Did you check?

@cro2003
Copy link
Owner

cro2003 commented Oct 11, 2024

Yea I checked, so just give this link https://www.rgpv.ac.in/Uni/ImpNoticeArchive.aspx for the archived notification

Added final modification. archive notifications page url added to the output json for the same.
@PavanTeja2005
Copy link
Contributor Author

The last change done. Please approve.

And please let me know if there are any important features to be added more in the project.

@PavanTeja2005
Copy link
Contributor Author

PLease merge this

@cro2003
Copy link
Owner

cro2003 commented Oct 12, 2024

Hey So Sorry, I am still busy. I will review and merge it within 48 hours.

@PavanTeja2005
Copy link
Contributor Author

Thank you

@cro2003
Copy link
Owner

cro2003 commented Oct 15, 2024

I have tested the Code from my Side too and it works well. Before merging it please Move this notification code to the info_api.py file instead of result_api.py file and also modify the init.py file and at last the Alert from the rgpv homepage title also shows "Click here to View" along with the title so remove that too.

@PavanTeja2005
Copy link
Contributor Author

Modified according to requirements

@cro2003
Copy link
Owner

cro2003 commented Oct 19, 2024

get_notification() & fetch_alerts() are still available in the result_api.py and it would be great you can move both both get_notification() & fetch_alerts() in the class as the static method, right now they are both outside the class [info_api.py file].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fetch new notifications
2 participants