Closed arumoy-shome closed 7 years ago
Both will come from API only
we can use the terms/list
endpoint. We only want to create a record for the current term. So use the current_term
field to grab the id
and the list of terms per year to fetch the description
of the term we are saving.
{"meta":
{"requests":226,
"timestamp":1501445962,
"status":200,
"message":"Request successful",
"method_id":1409,"method":{}},
"data":
{"previous_term":1171,
"current_term":1175,
"next_term":1179,
"listings":
{"2016":[{"id":1161,"name":"Winter 2016"},{"id":1165,"name":"Spring 2016"},{"id":1169,"name":"Fall 2016"}],
"2017":[{"id":1171,"name":"Winter 2017"},{"id":1175,"name":"Spring 2017"},{"id":1179,"name":"Fall 2017"}],
"2018":[{"id":1181,"name":"Winter 2018"},{"id":1185,"name":"Spring 2018"},{"id":1189,"name":"Fall 2018"}]}}}
We can add a polymorphic new
method which adds the above functionality and uses the built in new
from active record behind the scenes.
Details are in #32 but essentially this will allow us to have a more realistic data model and prevent data loss in the long run, which is something the current model lacks.