Fix HamStudy image error

- Fixed the image link
- Removed unused import (pytz)
- Added test pool file to dev-notes

Fixes #203
This commit is contained in:
0x5c 2020-02-25 19:45:32 -05:00
parent 38416d9050
commit 2049ca9fca
No known key found for this signature in database
GPG Key ID: 82039FC95E3FE970
3 changed files with 51 additions and 2 deletions

View File

@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased]
### Fixed
- Fixed issue where HamStudy questions with images would cause an error.
## [2.2.1] - 2020-02-20

View File

@ -0,0 +1,48 @@
{
"_id": "56956f51f65e5c590272e372",
"appears": "2016-04-01T06:00:00.000Z",
"class": "Amateur Extra",
"subtext": "Expires Jul 1, 2020",
"valid_from": "2016-07-01T06:00:00.000Z",
"expires": "2020-07-01T06:00:00.000Z",
"official_name": "Element 4",
"id": "E4_2016",
"slug": "extra2016",
"passing": 37,
"year": 2016,
"pool": [{
"_id": "5cd63f15910d9b003d545bd7",
"qcount": 4,
"id": "E5",
"name": "ELECTRICAL PRINCIPLES",
"sections": [{
"_id": "5cd63f15910d9b003d545beb",
"id": "E5C",
"questions": [{
"_id": "5cd63f15910d9b003d545bef",
"keywords": ["4"],
"answer": "B",
"answers": {
"A": "Point 2",
"B": "Point 4",
"C": "Point 5",
"D": "Point 6"
},
"fccpart": "",
"id": "E5C14",
"image": "E5-2.png",
"text": "Which point on Figure E5-2 best represents the impedance of a series circuit consisting of a 400 ohm resistor and a 38 picofarad capacitor at 14 MHz?"
}],
"summary": "Coordinate systems and phasors in electronics: Rectangular Coordinates; Polar Coordinates; Phasors"
}]
}],
"updated": "2019-05-11T03:18:46.121Z",
"category": "default",
"testIdEnd": 19999,
"testIdStart": 10000,
"__v": 12,
"mat_icon": "flash_on",
"tagline": "Serious General operators only! This is the most advanced US license class!",
"keywords": ["ham radio extra test prep", "amateur extra class radio study", "amateur extra class ham exam", "ham radio amateur extra test 2016", "2016 amateur extra class", "ham radio license exam", "extra class flash card"],
"replaces": "E4_2012"
}

View File

@ -14,7 +14,6 @@ from datetime import datetime
import asyncio
import aiohttp
import pytz
import discord.ext.commands as commands
@ -134,7 +133,7 @@ class StudyCog(commands.Cog):
" the answer will be revealed."),
inline=False)
if "image" in question:
image_url = f"https://hamstudy.org/_1330011/images/{pool.split('_',1)[1]}/{question['image']}"
image_url = f"https://hamstudy.org/images/{pool_meta['year']}/{question['image']}"
embed.set_image(url=image_url)
q_msg = await ctx.send(embed=embed)