gi-kent-content / hca-tuatara

A little python-based web site for helping the wranglers and others track incoming single cell projects as they are brought into HCA. The Tuatara has an extra eye which comes in handy in this project.
MIT License
2 stars 1 forks source link

Added project suggestion to database and webpage #41

Closed willrockout closed 3 years ago

willrockout commented 3 years ago

Updated HTML and database to be able to take project suggestions. This also includes some code clean up of the base.html

galt commented 3 years ago

It looks like this feature needs a few tweaks. When I merge it into a test branch on my dev instance and migrate and start it up, it was very hard for me to use because it was not showing error messages most of the time. Initially, it did not like my website "http://stuff". But it did not say that it wants a fully qualified domain name, or which field it was unhappy about. Later, I tried entering a record that had a different title, but the same submitter name, and it again failed to submit, but gave no error that there was a problem because it is expecting both the title and the submitter to be unique. So once a person has entered even just one record under a submitter's name, they will be unable to submit any more records under that name. The field in the mysql table has an index to ensure uniqueness, and I suppose that it is good it enforces it, but where is the error message, and why can't a Submitter submit more than one?

galt commented 3 years ago
+------------------------+------------+----------------+--------------+----------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table                  | Non_unique | Key_name       | Seq_in_index | Column_name    | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+------------------------+------------+----------------+--------------+----------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| hcat_suggestedprojects |          0 | PRIMARY        |            1 | id             | A         |           1 |     NULL | NULL   |      | BTREE      |         |               |
| hcat_suggestedprojects |          0 | title          |            1 | title          | A         |           1 |     NULL | NULL   |      | BTREE      |         |               |
| hcat_suggestedprojects |          0 | submitter_name |            1 | submitter_name | A         |           1 |     NULL | NULL   |      | BTREE      |         |               |
+------------------------+------------+----------------+--------------+----------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
galt commented 3 years ago

Recommend you remove the uniqueness requrement for sure on submitter. Maybe it does not even need title to be unique. It needs to tell the user why it is unhappy with meaningful errors.

willrockout commented 3 years ago

@galt I've made the changes to the error reporting, changed submitter name to not be unique and removed links being a URL field to make it easier for people submitting links. You should restoreFromProd then pull the new changes for this branch and run migrate. Let me know if you notice anything else.

galt commented 3 years ago

I tried it again on my instance. The things you fixed all seem to be working.

One additional thing I noticed is that AFTER you have successfully complete the suggestions form, it adds the record into the db as expected, and redraws the main page again.

But the URL in the browser still shows http://hgwdev.gi.ucsc.edu:8125/suggest/ it should no longer be under /suggest/ model. It should just show / I do not know why this happens, but you can probably figure it out.

willrockout commented 3 years ago

Ah, great catch didn't notice that! Fixed the redirect in views and pushed it so should be good now.

galt commented 3 years ago

I updated the production server git repo, ran migrate and restarted apache. The changes are on production.