wlmac / metropolis

William Lyon Mackenzie's online hub for announcements, calendar events, clubs, and timetables
https://maclyonsden.com
GNU Affero General Public License v3.0
21 stars 6 forks source link

automatically create clubs from a csv file wowies #252

Closed pinwheeeel closed 6 months ago

pinwheeeel commented 6 months ago

https://github.com/wlmac/metropolis/issues/247

usage: poetry run python ./manage.py add_clubs ./path_to_csv_file

JasonLovesDoggo commented 6 months ago

Yep, just compares to check if the content of both are the same. Please remove the numpy dependency before I merge.

On Mon, Feb 5, 2024, 12:56 AM pinwheeeel @.***> wrote:

@.**** commented on this pull request.

In core/management/commands/add_clubs.py https://github.com/wlmac/metropolis/pull/252#discussion_r1477700883:

  • with open(csv_file, 'r') as csv_file:
  • csv_reader = csv.reader(csv_file)
  • header = [
  • "CLUB NAME",
  • "APPROVED & MAILED",
  • "SAF PAID",
  • "PRESIDENT(S)",
  • "PRESIDENT(S) EMAIL",
  • "STAFF SUPERVISOR(S)",
  • "STAFF(S) EMAIL",
  • "BUDGET REQUEST",
  • "TIME + PLACE",
  • "SOCIAL LINKS"
  • ]
  • assert np.array_equal(header, next(csv_reader)), "CSV layout changed since the last time the script was updated"

didnt know python can do that

— Reply to this email directly, view it on GitHub https://github.com/wlmac/metropolis/pull/252#discussion_r1477700883, or unsubscribe https://github.com/notifications/unsubscribe-auth/AP3WJYRFXRLG4BH5Y6ZBVNTYSBYCJAVCNFSM6AAAAABCZO62TOVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTQNRRHEZTOOBTG4 . You are receiving this because your review was requested.Message ID: @.***>

JasonLovesDoggo commented 6 months ago

Sorry to ask but could you just modify the input to either accept a flag that allows it to fetch it from URL or just change the logic to that?

pinwheeeel commented 6 months ago

Oh okay, will work on it sometime later