* feat: Show bluesheets using Attended tables (#7094) * feat: Show bluesheets using Attended tables (#6898) * feat: Allow users to add themselves to session attendance (#6454) * chore: Correct copyright year * fix: Address review comments * fix: Don't try to generate empty bluesheets * refactor: Complete rewrite of bluesheet.html * refactor: Fill in a few gaps, close a few holes - Rename the live "bluesheet" to "attendance", add some explanatory text. - Add attendance links in materials view and pre-finalized proceedings view. - Don't allow users to add themselves after the corrections cutoff date. * fix: Report file-save errors to caller * fix: Address review comments * fix: typo * refactor: if instead of except; refactor gently * refactor: Rearrange logic a little, add comment * style: Black * refactor: auto_now_add->default to allow override * refactor: jsonschema to validate API payload * feat: Handle new API data format Not yet tested except that it falls back when the old format is used. * test: Split test into deprecated/new version Have not yet touched the new version * style: Black * test: Test new add_session_attendees API * fix: Fix bug uncovered by test * refactor: Refactor affiliation lookup a bit * fix: Order bluesheet by Attended.time * refactor: Move helpers from views.py to utils.py * test: Test that finalize calls generate_bluesheets * test: test_bluesheet_data() * fix: Clean up merge * fix: Remove debug statement * chore: comments * refactor: Renumber migrations --------- Co-authored-by: Paul Selkirk <paul@painless-security.com> * chore: Remove unused import * style: Black * feat: Stub session update notify API * feat: Add order & rev to slides JSON * style: Black * feat: Stub actual Meetecho slide deck mgmt API * refactor: Limit reordering to type="slides" * chore: Remove repository from meetecho API (API changed on their end) * feat: update Meetecho on slide reorder * refactor: drop pytz from meetecho.py * chore: Remove more repository refs * refactor: Eliminate more pytz * test: Test add_slide_deck api * fix: Allow 202 status code / absent Content-Type * test: Test delete_slide_deck api * test: Test update_slide_decks api * refactor: sessionpresentation_set -> presentations * test: Test send_update() * fix: Debug send_update() * test: ajax_reorder_slides calls Meetecho API * test: Test SldesManager.add() * feat: Implement SlidesManager.add() * test: Test that ajax_add_slides... calls API * feat: Call Meetecho API when slides added to session * test: Test SlidesManager.delete() * feat: Implement SlidesManager.delete() * test: ajax_remove_slides... calls Meetecho API * feat: Call Meetecho API when slides removed * chore: Update docstring * feat: rudimentary debug mode for Meetecho API * test: remove_sessionpresentation() calls Meetecho API * feat: Call Meetecho API from remove_sessionpresentation() * test: upload_slides() calls Meetecho API * style: Black * fix: Refactor/debug upload_session_slides Avoids double-save of a SessionPresentation for the session being updated and updates other sessions when apply_to_all is set (previously it only created ones that did not exist, so rev would never be updated). * test: Fix test bug * feat: Call Meetecho API when uploading session slides * fix: Only replace slides actually linked to session * fix: Delint Removed some type checking rather than debugging it * fix: Send get_versionless_href() as url for slides * test: TZ-aware timestamps, please * chore: Add comments * feat: Call Meetecho API in edit_sessionpresentation * feat: Call Meetecho API in remove_sessionpresentation * feat: Call Meetecho API from add_sessionpresentation * fix: Set order in add_sessionpresentation * fix: Restrict API calls to "slides" docs * feat: Call Meetecho API on title changes * test: Check meetecho API calls in test_revise() * fix: better Meetecho API "order" management * fix: no PUT if there are no slides after DELETE * feat: Catch exceptions from SlidesManager Don't let errors in the MeetEcho slides API interfere with the ability to modify slides for a session. * feat: Limit which sessions we send notifications for * fix: handle absence of request_timeout in api config * test: always send slide notifications in tests * fix: save slides before sending notification (#7172) * fix: save slides before sending notification * style: fix indentation It's not a bug, it's a flourish! --------- Co-authored-by: Jennifer Richards <jennifer@staff.ietf.org> Co-authored-by: Paul Selkirk <paul@painless-security.com>
77 lines
3.5 KiB
Python
77 lines
3.5 KiB
Python
# Copyright The IETF Trust 2017-2020, All Rights Reserved
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
from django.db import models
|
|
|
|
import debug # pyflakes:ignore
|
|
|
|
from ietf.meeting.models import Meeting
|
|
from ietf.name.models import CountryName
|
|
from ietf.person.models import Person
|
|
from ietf.utils.models import ForeignKey
|
|
|
|
### NOTE WELL: These models are expected to be removed and the stats app reimplemented.
|
|
# A bare python file that should have been a management command was used to populate
|
|
# these models when the app was first installed - it has been removed from main, but
|
|
# can be seen at https://github.com/ietf-tools/datatracker/blob/f2b716fc052a0152c32b86b428ba6ebfdcdf5cd2/ietf/stats/backfill_data.py
|
|
|
|
class AffiliationAlias(models.Model):
|
|
"""Records that alias should be treated as name for statistical
|
|
purposes."""
|
|
|
|
alias = models.CharField(max_length=255, help_text="Note that aliases will be matched case-insensitive and both before and after some clean-up.", unique=True)
|
|
name = models.CharField(max_length=255)
|
|
|
|
def __str__(self):
|
|
return "{} -> {}".format(self.alias, self.name)
|
|
|
|
def save(self, *args, **kwargs):
|
|
self.alias = self.alias.lower()
|
|
update_fields = {"alias"}.union(kwargs.pop("update_fields", set()))
|
|
super(AffiliationAlias, self).save(update_fields=update_fields, *args, **kwargs)
|
|
|
|
class Meta:
|
|
verbose_name_plural = "affiliation aliases"
|
|
|
|
class AffiliationIgnoredEnding(models.Model):
|
|
"""Records that ending should be stripped from the affiliation for statistical purposes."""
|
|
|
|
ending = models.CharField(max_length=255, help_text="Regexp with ending, e.g. 'Inc\\.?' - remember to escape .!")
|
|
|
|
def __str__(self):
|
|
return self.ending
|
|
|
|
class CountryAlias(models.Model):
|
|
"""Records that alias should be treated as country for statistical
|
|
purposes."""
|
|
|
|
alias = models.CharField(max_length=255, help_text="Note that lower-case aliases are matched case-insensitive while aliases with at least one uppercase letter is matched case-sensitive. So 'United States' is best entered as 'united states' so it both matches 'United States' and 'United states' and 'UNITED STATES', whereas 'US' is best entered as 'US' so it doesn't accidentally match an ordinary word like 'us'.")
|
|
country = ForeignKey(CountryName, max_length=255)
|
|
|
|
def __str__(self):
|
|
return "{} -> {}".format(self.alias, self.country.name)
|
|
|
|
class Meta:
|
|
verbose_name_plural = "country aliases"
|
|
|
|
class MeetingRegistration(models.Model):
|
|
"""Registration attendee records from the IETF registration system"""
|
|
meeting = ForeignKey(Meeting)
|
|
first_name = models.CharField(max_length=255)
|
|
last_name = models.CharField(max_length=255)
|
|
affiliation = models.CharField(blank=True, max_length=255)
|
|
country_code = models.CharField(max_length=2) # ISO 3166
|
|
person = ForeignKey(Person, blank=True, null=True)
|
|
email = models.EmailField(blank=True, null=True)
|
|
reg_type = models.CharField(blank=True, max_length=255)
|
|
ticket_type = models.CharField(blank=True, max_length=255)
|
|
# attended was used prior to the introduction of the ietf.meeting.Attended model and is still used by
|
|
# Meeting.get_attendance() for older meetings. It should not be used except for dealing with legacy data.
|
|
attended = models.BooleanField(default=False)
|
|
# checkedin indicates that the badge was picked up
|
|
checkedin = models.BooleanField(default=False)
|
|
|
|
def __str__(self):
|
|
return "{} {}".format(self.first_name, self.last_name)
|