I'm mostly confused about the sentence structure. Would this be correct? 你做完上个星期老师给我们的作业了吗
Your translation is correct. Let's see the sentence:
Have you finished doing the homework (which) our teacher gave us last week?
We can divide the sentence into 2 parts:
- Have you finished doing the homework?你完成作业了吗？
2.Our teacher gave us the homework last week.（我们）老师上周布置的作业。
Here 老师上周布置的作业 is a noun. 老师上周布置的 is an adjective. Then we combine these 2 sentences with the repeated word 作业.
Here is just one example and there are some other correct translation versions like 你做完了老师上星期给我们布置的作业吗，你完成了上星期老师给我们布置的作业吗，etc. Chinese people can understand your translation if there aren't many serious grammar mistakes. Usually we don't focus that much on grammatical problems when we use Chinese as Chinese people.