-
Notifications
You must be signed in to change notification settings - Fork 471
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
fix: remove unreliable statistics #8307
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -809,8 +809,8 @@ def skip_unreadable_post(record): | |
SESSION_REQUEST_FROM_EMAIL = 'IETF Meeting Session Request Tool <[email protected]>' | ||
|
||
SECRETARIAT_SUPPORT_EMAIL = "[email protected]" | ||
SECRETARIAT_ACTION_EMAIL = "[email protected]" | ||
SECRETARIAT_INFO_EMAIL = "[email protected]" | ||
SECRETARIAT_ACTION_EMAIL = SECRETARIAT_SUPPORT_EMAIL | ||
SECRETARIAT_INFO_EMAIL = SECRETARIAT_SUPPORT_EMAIL | ||
|
||
# Put real password in settings_local.py | ||
IANA_SYNC_PASSWORD = "secret" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,22 +13,16 @@ | |
import debug # pyflakes:ignore | ||
|
||
from django.urls import reverse as urlreverse | ||
from django.utils import timezone | ||
|
||
from ietf.utils.test_utils import login_testing_unauthorized, TestCase | ||
import ietf.stats.views | ||
|
||
from ietf.submit.models import Submission | ||
from ietf.doc.factories import WgDraftFactory, WgRfcFactory | ||
from ietf.doc.models import Document, State, RelatedDocument, NewRevisionDocEvent, DocumentAuthor | ||
|
||
from ietf.group.factories import RoleFactory | ||
from ietf.meeting.factories import MeetingFactory, AttendedFactory | ||
from ietf.meeting.factories import MeetingFactory | ||
from ietf.person.factories import PersonFactory | ||
from ietf.person.models import Person, Email | ||
from ietf.name.models import FormalLanguageName, DocRelationshipName, CountryName | ||
from ietf.review.factories import ReviewRequestFactory, ReviewerSettingsFactory, ReviewAssignmentFactory | ||
from ietf.stats.models import MeetingRegistration, CountryAlias | ||
from ietf.stats.factories import MeetingRegistrationFactory | ||
from ietf.stats.models import MeetingRegistration | ||
from ietf.stats.tasks import fetch_meeting_attendance_task | ||
from ietf.stats.utils import get_meeting_registration_data, FetchStats, fetch_attendance_from_meetings | ||
from ietf.utils.timezone import date_today | ||
|
@@ -41,121 +35,14 @@ def test_stats_index(self): | |
self.assertEqual(r.status_code, 200) | ||
|
||
def test_document_stats(self): | ||
WgRfcFactory() | ||
draft = WgDraftFactory() | ||
DocumentAuthor.objects.create( | ||
document=draft, | ||
person=Person.objects.get(email__address="[email protected]"), | ||
email=Email.objects.get(address="[email protected]"), | ||
country="Germany", | ||
affiliation="IETF", | ||
order=1 | ||
) | ||
|
||
# create some data for the statistics | ||
Submission.objects.create( | ||
authors=[ { "name": "Some Body", "email": "[email protected]", "affiliation": "Some Inc.", "country": "US" }], | ||
pages=30, | ||
rev=draft.rev, | ||
words=4000, | ||
draft=draft, | ||
file_types=".txt", | ||
state_id="posted", | ||
) | ||
|
||
draft.formal_languages.add(FormalLanguageName.objects.get(slug="xml")) | ||
Document.objects.filter(pk=draft.pk).update(words=4000) | ||
# move it back so it shows up in the yearly summaries | ||
NewRevisionDocEvent.objects.filter(doc=draft, rev=draft.rev).update( | ||
time=timezone.now() - datetime.timedelta(days=500)) | ||
|
||
referencing_draft = Document.objects.create( | ||
name="draft-ietf-mars-referencing", | ||
type_id="draft", | ||
title="Referencing", | ||
stream_id="ietf", | ||
abstract="Test", | ||
rev="00", | ||
pages=2, | ||
words=100 | ||
) | ||
referencing_draft.set_state(State.objects.get(used=True, type="draft", slug="active")) | ||
RelatedDocument.objects.create( | ||
source=referencing_draft, | ||
target=draft, | ||
relationship=DocRelationshipName.objects.get(slug="refinfo") | ||
) | ||
NewRevisionDocEvent.objects.create( | ||
type="new_revision", | ||
by=Person.objects.get(name="(System)"), | ||
doc=referencing_draft, | ||
desc="New revision available", | ||
rev=referencing_draft.rev, | ||
time=timezone.now() - datetime.timedelta(days=1000) | ||
) | ||
r = self.client.get(urlreverse("ietf.stats.views.document_stats")) | ||
self.assertRedirects(r, urlreverse("ietf.stats.views.stats_index")) | ||
|
||
|
||
# check redirect | ||
url = urlreverse(ietf.stats.views.document_stats) | ||
|
||
authors_url = urlreverse(ietf.stats.views.document_stats, kwargs={ "stats_type": "authors" }) | ||
|
||
r = self.client.get(url) | ||
self.assertEqual(r.status_code, 302) | ||
self.assertTrue(authors_url in r["Location"]) | ||
|
||
# check various stats types | ||
for stats_type in ["authors", "pages", "words", "format", "formlang", | ||
"author/documents", "author/affiliation", "author/country", | ||
"author/continent", "author/citations", "author/hindex", | ||
"yearly/affiliation", "yearly/country", "yearly/continent"]: | ||
for document_type in ["", "rfc", "draft"]: | ||
for time_choice in ["", "5y"]: | ||
url = urlreverse(ietf.stats.views.document_stats, kwargs={ "stats_type": stats_type }) | ||
r = self.client.get(url, { | ||
"type": document_type, | ||
"time": time_choice, | ||
}) | ||
self.assertEqual(r.status_code, 200) | ||
q = PyQuery(r.content) | ||
self.assertTrue(q('#chart')) | ||
if not stats_type.startswith("yearly"): | ||
self.assertTrue(q('table.stats-data')) | ||
|
||
def test_meeting_stats(self): | ||
# create some data for the statistics | ||
meeting = MeetingFactory(type_id='ietf', date=date_today(), number="96") | ||
MeetingRegistrationFactory(first_name='John', last_name='Smith', country_code='US', email="[email protected]", meeting=meeting, attended=True) | ||
CountryAlias.objects.get_or_create(alias="US", country=CountryName.objects.get(slug="US")) | ||
p = MeetingRegistrationFactory(first_name='Jaume', last_name='Guillaume', country_code='FR', email="[email protected]", meeting=meeting, attended=False).person | ||
CountryAlias.objects.get_or_create(alias="FR", country=CountryName.objects.get(slug="FR")) | ||
AttendedFactory(session__meeting=meeting,person=p) | ||
# check redirect | ||
url = urlreverse(ietf.stats.views.meeting_stats) | ||
|
||
authors_url = urlreverse(ietf.stats.views.meeting_stats, kwargs={ "stats_type": "overview" }) | ||
|
||
r = self.client.get(url) | ||
self.assertEqual(r.status_code, 302) | ||
self.assertTrue(authors_url in r["Location"]) | ||
|
||
# check various stats types | ||
for stats_type in ["overview", "country", "continent"]: | ||
url = urlreverse(ietf.stats.views.meeting_stats, kwargs={ "stats_type": stats_type }) | ||
r = self.client.get(url) | ||
self.assertEqual(r.status_code, 200) | ||
q = PyQuery(r.content) | ||
self.assertTrue(q('#chart')) | ||
if stats_type == "overview": | ||
self.assertTrue(q('table.stats-data')) | ||
r = self.client.get(urlreverse("ietf.stats.views.meeting_stats")) | ||
self.assertRedirects(r, urlreverse("ietf.stats.views.stats_index")) | ||
|
||
for stats_type in ["country", "continent"]: | ||
url = urlreverse(ietf.stats.views.meeting_stats, kwargs={ "stats_type": stats_type, "num": meeting.number }) | ||
r = self.client.get(url) | ||
self.assertEqual(r.status_code, 200) | ||
q = PyQuery(r.content) | ||
self.assertTrue(q('#chart')) | ||
self.assertTrue(q('table.stats-data')) | ||
|
||
def test_known_country_list(self): | ||
# check redirect | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What were the replaced addresses doing? Old aliases in the mail system?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the secretariat used to use these aliases to drop tickets into separate queues for different types of requests. Now, everything is intended to go support@ instead, with queuing happening later, so that the community doesn't have to figure out which of many addresses to use. We have code that could be refactored to simplify having this many settings, but that should be a separate PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also - the other aliases just forward to support@ currently