Skip to content
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

create submission files and seen data #5580

Merged
merged 2 commits into from Oct 20, 2020
Merged

Conversation

sssoleileraaa
Copy link
Contributor

@sssoleileraaa sssoleileraaa commented Oct 14, 2020

Description of Changes

Fixes #5451
Partially resolves: #5514

@sssoleileraaa sssoleileraaa force-pushed the create-dev-data-files branch 3 times, most recently from e013e05 to 7a5bd3e Compare October 15, 2020 01:31
@lgtm-com
Copy link

lgtm-com bot commented Oct 16, 2020

This pull request introduces 1 alert when merging 061ebcb into a0b53d3 - view on LGTM.com

new alerts:

  • 1 for Variable defined multiple times

@sssoleileraaa
Copy link
Contributor Author

sssoleileraaa commented Oct 16, 2020

I added one more commit that adds seen data so that a third of sources created are marked as seen (all their submissions are seen), a third of sources are unseen (with half their submissions seen), and a third of sources are unseen (with zero submissions seen, although the replies to these source will have been seen, since all replies are seen).

You can verify this works by confirming make dev behavior:

  1. make dev
  • confirm you see that 3 journalists were created by checkout stdout logs
  1. log into the client
  • there are 3 sources, each with 2 messages, 2 files, and 2 replies
  1. docker exec -it securedrop-dev-0 bash
  2. sqlite3 /var/lib/securedrop/db.sqlite
  • confirm one source has 0 seen messages and 0 seen files by making sure submission ids 1,2,3,4 are not in the seen tables (should look like the sql results below)
  • confirm one source has all their messages and files seen by making sure submission ids 5,6,7,8 are in the seen tables (should look like the sql results below)
  • confirm one source has 1 message and 1 file seen by making sure submission ids 9,11 are in the seen tables (should look like the sql results below)
sqlite> select * from seen_files;
1|7|1
2|8|1
3|11|1
sqlite> select * from seen_messages;
1|5|1
2|6|1
3|9|1
  • confirm that each sender of a reply has a seen record in the seen_replies table: one source has two replies sent by the deleted user (so journalist_id will be null), the rest of the sources have replies sent by dellsberg with journalist_id=2
  • confirm that one source has 0 replies seen by journalist with journalist_id=1 by making sure (reply_id, journalist_id) = (1, 1) and (reply_id, journalist_id) = (2, 1) does not exist
  • confirm that one source has both replies seen by journalist with journalist_id=1 by making sure (reply_id, journalist_id) = (3, 1) and (reply_id, journalist_id) = (4, 1) does exist
  • confirm that one source has only one reply seen by journalist with journalist_id=1 by making sure (reply_id, journalist_id) = (5, 1) exists and (reply_id, journalist_id) = (6, 1) does not exist
  • the results should look like the following:
sqlite> select * from seen_replies;
1|1|
2|2|
3|3|2
4|3|1
5|4|2
6|4|1
7|5|2
8|5|1
9|6|2

@sssoleileraaa
Copy link
Contributor Author

(once #5503 is resolved we can get rid of the id column and make the primary key equal the two foreign keys, which has the benefit of making sql results easier to read)

@sssoleileraaa sssoleileraaa changed the title create submission files by default create submission files and seen data Oct 16, 2020
Copy link
Contributor

@kushaldas kushaldas left a comment

Choose a reason for hiding this comment

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

Works as expected in the dev environment and also CI is green. I can create my user easily in staging.

Tested steps from the PR:

  1. make dev
  • confirm you see that 3 journalists were created by checkout stdout logs
  1. log into the client
  • there are 3 sources, each with 2 messages, 2 files, and 2 replies
  1. docker exec -it securedrop-dev-0 bash
  2. sqlite3 /var/lib/securedrop/db.sqlite
  • confirm one source has 0 seen messages and 0 seen files by making sure submission ids 1,2,3,4 are not in the seen tables (should look like the sql results below)
  • confirm one source has all their messages and files seen by making sure submission ids 5,6,7,8 are in the seen tables (should look like the sql results below)
  • confirm one source has 1 message and 1 file seen by making sure submission ids 9,11 are in the seen tables (should look like the sql results below)
sqlite> select * from seen_files;
1|7|1
2|8|1
3|11|1
sqlite> select * from seen_messages;
1|5|1
2|6|1
3|9|1
  • confirm that each sender of a reply has a seen record in the seen_replies table: one source has two replies sent by the deleted user (so journalist_id will be null), the rest of the sources have replies sent by dellsberg with journalist_id=2
  • confirm that one source has 0 replies seen by journalist with journalist_id=1 by making sure (reply_id, journalist_id) = (1, 1) and (reply_id, journalist_id) = (2, 1) does not exist
  • confirm that one source has both replies seen by journalist with journalist_id=1 by making sure (reply_id, journalist_id) = (3, 1) and (reply_id, journalist_id) = (4, 1) does exist
  • confirm that one source has only one reply seen by journalist with journalist_id=1 by making sure (reply_id, journalist_id) = (5, 1) exists and (reply_id, journalist_id) = (6, 1) does not exist
  • the results should look like the following:
sqlite> select * from seen_replies;
1|1|
2|2|
3|3|2
4|3|1
5|4|2
6|4|1
7|5|2
8|5|1
9|6|2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Add seen data to qa_loader Optionally include file attachments when generating server data with make dev
2 participants