-
Notifications
You must be signed in to change notification settings - Fork 911
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add v8 mockdata #6261
Add v8 mockdata #6261
Conversation
PR Analysis
PR Feedback
How to useInstructions
|
@@ -75,7 +75,7 @@ def remove_translations(zone_key: ZoneKey): | |||
|
|||
|
|||
def remove_mockserver_data(zone_key: ZoneKey): | |||
for API_version in ["v6", "v7"]: | |||
for API_version in ["v7", "v8"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Instead of hardcoding the API versions, consider using a variable that contains all the versions. This will make the code more maintainable.
for API_version in ["v7", "v8"]: | |
API_versions = ["v7", "v8"] | |
def remove_mockserver_data(zone_key: ZoneKey): | |
for API_version in API_versions: | |
for state_level in ["daily", "hourly", "monthly", "yearly"]: | |
try: | |
with JsonFilePatcher( |
@@ -12,7 +12,7 @@ const fetchAndStoreData = async (url, savePath) => { | |||
return axios.get(url).then((res) => writeJSON(savePath, res.data)); | |||
}; | |||
|
|||
const CORE_URL = 'http://localhost:8001/v6'; | |||
const CORE_URL = 'http://localhost:8001/v8'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: Similar to the previous suggestion, consider using a variable for the API version in the URL. This will make the code more maintainable and easier to update in the future.
const CORE_URL = 'http://localhost:8001/v8'; | |
const API_VERSION = 'v8'; | |
const CORE_URL = `http://localhost:8001/${API_VERSION}`; | |
const timeAggregates = ['hourly', 'daily', 'monthly', 'yearly']; | |
const detailsZones = ['DE', 'DK-DK2']; |
detailsZones.forEach(async (zoneId) => { | ||
await fetchAndStoreData( | ||
`${CORE_URL}/details/${agg}/${zoneId}`, | ||
`./public/v7/details/${agg}/${zoneId}.json` | ||
`./public/v8/details/${agg}/${zoneId}.json` | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: The 'fetchAndStoreData' function is called inside a forEach loop. This could lead to unexpected behavior due to the asynchronous nature of JavaScript. Consider using 'Promise.all' to handle these asynchronous operations.
detailsZones.forEach(async (zoneId) => { | |
await fetchAndStoreData( | |
`${CORE_URL}/details/${agg}/${zoneId}`, | |
`./public/v7/details/${agg}/${zoneId}.json` | |
`./public/v8/details/${agg}/${zoneId}.json` | |
); | |
await Promise.all(detailsZones.map(async (zoneId) => { | |
await fetchAndStoreData( | |
`${CORE_URL}/details/${agg}/${zoneId}`, | |
`./public/v8/details/${agg}/${zoneId}.json` | |
); | |
})); |
This is in case I get bored in the middle of the woods and want to work with no internet connection 😅 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM :)
It seems this PR may have impacted the Cypress tests on master, as there's an issue with the zone details API not loading the expected data. |
I'll take care of it! |
Any news on this, @VIKTORVAV99? This PR introduced different dates for the state and the details files (2022 vs 2023) :) |
I thought it would be a quick fix, but for some unknown reason the details and state files are out of sync by days by the look of it. And when I tired to update them again I got the same issue. I'll see if I can download some new data later today and hopefully they will be in sync... This works in the v8 pr though 😅 |
I just realised you also fixed this in the v8 branch, so I'm wondering if we should split out the mockserver/cy-testing part from that PR or try to get the whole thing reviewed and merged soon? :) |
They are kind of tied hand in hand as the tests should reflect that the app is calling a new endpoint. But I have been testing the preview branch a bunch and so far I have not found any issues besides those I solved yesterday. So we could just go forward with that. But I had hoped we could sneak in a fix for the GFS data structure being different between the endpoints but I suppose we could do that later on as it calls another endpoint. |
Description
This adds v8 mock data, updates the v7 mock data and removes the v6 mock data that are no longer in use.