Exemple #1
0
def update_event_info(event_id):
    if event_id:
        event_http = api.get_event_info(event_id)
        if event_http:
            event_db = db_event.get_event(event_id)
            if not event_db:
                event_tt = api.fetch_timetable(event_id)
                db_event.store_event(event_http, event_tt)
            elif utc.localize(event_db["modificationDate"]) < dt_from_indico(event_http["modificationDate"]):
                db_event.remove_event(event_id)
                event_tt = api.fetch_timetable(event_id)
                db_event.store_event(event_http, event_tt)
Exemple #2
0
def update_event_info(event_id):
    if event_id:
        event_http = api.get_event_info(event_id)
        if event_http:
            event_db = db_event.get_event(event_id)
            if not event_db:
                event_tt = api.fetch_timetable(event_id)
                db_event.store_event(event_http, event_tt)
            elif utc.localize(event_db['modificationDate']) < dt_from_indico(
                    event_http['modificationDate']):
                db_event.remove_event(event_id)
                event_tt = api.fetch_timetable(event_id)
                db_event.store_event(event_http, event_tt)
Exemple #3
0
def get_future_contributions():
    events = api.get_future_events()
    for event in events:
        if not db_event.get_event(event['id']):
            # store event
            event_tt = api.fetch_timetable(event['id'])
            db_event.store_event(event, event_tt)

    now = datetime.utcnow()
    tomorrow = now + timedelta(hours=6)
    results = list(db_contribution.get_contributions(now, tomorrow, [{'hasAnyProtection': False},
                                                                     {'_fossil': 'contribSchEntryDisplay'}])) \
            + list(db_event.get_ongoing_lectures(now, tomorrow))
    return sorted(results, key=lambda x: x['startDate'])
Exemple #4
0
def get_ongoing_contributions():
    events = api.get_ongoing_events()
    for event in events:
        if not db_event.get_event(event['id']):
            # store event
            event_tt = api.fetch_timetable(event['id'])
            db_event.store_event(event, event_tt)

    now = datetime.utcnow()
    tomorrow = now + timedelta(hours=6)
    results = list(db_contribution.get_contributions(now, tomorrow, [{'hasAnyProtection': False},
                                                                             {'_fossil': 'contribSchEntryDisplay'}])) \
            + list(db_event.get_ongoing_lectures(now, tomorrow))
    return sorted(results, key=lambda x: x['startDate'])
Exemple #5
0
def get_future_contributions():
    events = api.get_future_events()
    for event in events:
        if not db_event.get_event(event["id"]):
            # store event
            event_tt = api.fetch_timetable(event["id"])
            db_event.store_event(event, event_tt)

    now = datetime.utcnow()
    tomorrow = now + timedelta(hours=6)
    results = list(
        db_contribution.get_contributions(
            now, tomorrow, [{"hasAnyProtection": False}, {"_fossil": "contribSchEntryDisplay"}]
        )
    ) + list(db_event.get_ongoing_lectures(now, tomorrow))
    return sorted(results, key=lambda x: x["startDate"])
Exemple #6
0
def get_ongoing_contributions():
    events = api.get_ongoing_events()
    for event in events:
        if not db_event.get_event(event['id']):
            # store event
            event_tt = api.fetch_timetable(event['id'])
            db_event.store_event(event, event_tt)

    now = datetime.utcnow()
    tomorrow = now + timedelta(hours=6)
    results = list(db_contribution.get_contributions(now, tomorrow, [{'hasAnyProtection': False},
                                                                             {'_fossil': 'contribSchEntryDisplay'}])) \
            + list(db_event.get_ongoing_lectures(now, tomorrow))

    if flask_session.get("indico_user", ""):
        for contrib in results:
            contrib["favorite"] = favorites.is_contribution_favorite(
                contrib, flask_session["indico_user"])
    return sorted(results, key=lambda x: x['startDate'])
Exemple #7
0
def get_ongoing_contributions():
    events = api.get_ongoing_events()
    for event in events:
        if not db_event.get_event(event["id"]):
            # store event
            event_tt = api.fetch_timetable(event["id"])
            db_event.store_event(event, event_tt)

    now = datetime.utcnow()
    tomorrow = now + timedelta(hours=6)
    results = list(
        db_contribution.get_contributions(
            now, tomorrow, [{"hasAnyProtection": False}, {"_fossil": "contribSchEntryDisplay"}]
        )
    ) + list(db_event.get_ongoing_lectures(now, tomorrow))

    if flask_session.get("indico_user", ""):
        for contrib in results:
            contrib["favorite"] = favorites.is_contribution_favorite(contrib, flask_session["indico_user"])
    return sorted(results, key=lambda x: x["startDate"])