Skip to content

Conversation

@zaynacheema
Copy link
Contributor

@zaynacheema zaynacheema commented May 21, 2025

An issue we've run into is that uploaded IF games are stored locally and only visible to different people. A possible workaround in order to implement a way for created IF games to be stored in the database is to do so that when someone runs migrations they can see the game on their site no matter who they are.

This is related to issue #1197

Since the website is not deployed, this is kind of not really feasible in a normal way but perhaps this can be done by editing the game model.

The main step is to store the twine file in binary and is accessible at a link resembling http://127.0.0.1:8000/games/twine-db/23/ (this is an example, like it would have the "twine-db" part)

After uploading "test-db" game I checked:

Image

And confirmed it was saved in binary.

The next step is to see if others can access the game but otherwise it has successfully been store in bytes which was the goal and achieved by altering the game model to store the file as a binary field rather than file field and updating all other files referencing it accordingly.

In order to see if others can access the same game, I will put the game in a fixture file
Which you can get by running python manage.py migrate
After pulling the branch.
You should see a game called "Midterm Project"

@zaynacheema zaynacheema self-assigned this May 21, 2025
@zaynacheema zaynacheema added this to the 2025/Sprint 4 milestone May 21, 2025
Copy link
Contributor

@gkharrell01 gkharrell01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When looking for a twine game, I recieve this error. Looks to be merge conflicts that need to be resolved! Let me know if I can help!
image

@zaynacheema
Copy link
Contributor Author

zaynacheema commented May 21, 2025

When looking for a twine game, I recieve this error. Looks to be merge conflicts that need to be resolved! Let me know if I can help! image

It looks like the issue is coming from another group's "friendinvitation" not being in our database so I made a migration and pushed it, it should be okay now.

Note, this functionality should also be tested on "Create Game" not create IF game as that was only recently pushed during this PR.

And reminder if you run migrations there should be a game Midterm project visible.

Copy link
Contributor

@gkharrell01 gkharrell01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Exciting that a game can be stored! Exciting to see more tangible work.

operations = [
migrations.AddField(
model_name="game",
name="twine_file_content",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Smart to use original game model!

from django.db import migrations, models


class Migration(migrations.Migration):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a lot of migrations, I wonder if there is an ability in a further PR to make these cumulative.

# ✅ Manually assign uploaded file
if self.request.FILES.get("twine_file"):
self.object.twine_file = self.request.FILES["twine_file"]
# save both the file and its contents
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, readable comments

<br />
{% endfor %}
<!-- Twine upload (manual field) -->
<label for="id_twine_file">Upload Twine Game (.html):</label>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking this will be updated once we merge other templates in other branches into dev

@zaynacheema
Copy link
Contributor Author

Test seems to be failed now from some tournament and lobby objects after merging with dev... not sure what to do as that's unrelated to us.

@jacqsmei
Copy link
Contributor

following up on this -- it would also be helpful if this game had a different name to match its purpose

@zaynacheema
Copy link
Contributor Author

following up on this -- it would also be helpful if this game had a different name to match its purpose

Changed! It is should now be named "Twine Test Game"

@zaynacheema
Copy link
Contributor Author

i've run into like a million merge conflicts and errors particularly from this repeating error:
ls: src/chigame/forum_conversation/models.py: No such file or directory

i'm not even sure how this is related and it does not even exist on my thing so i'm going to just try again to make a placeholder for it...

@zaynacheema
Copy link
Contributor Author

Ran into even more merge conflicts and have no idea how to resolve this since its not really related to my code? maybe something from working with the database but I have no idea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants