dPoll bug fixes: Content editing fixes and table representation on Markdown

View this thread on: d.buzz | hive.blog | peakd.com | ecency.com
·@tolgahanuzun·
0.000 HBD
dPoll bug fixes: Content editing fixes and table representation on Markdown
![resim.png](https://files.steempeak.com/file/steempeak/tolgahanuzun/6XnvuWX6-resim.png)

[dpoll.xyz](dpoll.xyz)
Source code: [github repository](https://github.com/emre/dpoll.xyz)

*What was the issues?*

## 1-The expire_at field is incorrectly set when editing.

This information was sent from the discord channel. 
![493149983c472980f4fd11e89256d9272dcfc7ec.png](https://files.steempeak.com/file/steempeak/tolgahanuzun/AFEIluIX-49314998-3c472980-f4fd-11e8-9256-d9272dcfc7ec.png)

- Poll options include 1 week and 1 month. This is the time allowed to vote in the poll. A poll page is updated. It is automatically set to 1 month regardless of user preference.

## 2-Markdown type table data is not shown.

This information was sent from the discord channel. But it was advanced through github.

https://github.com/emre/dpoll.xyz/issues/67

- When you create a table with Markdown, it occurs smoothly by the editor. However, there is no table support in html conversion in backend codes.

*What was the solution?*

## 1 - Fixed : https://github.com/emre/dpoll.xyz/pull/58

```
@property
def expire_at_humanized(self):
    diff_in_days = (self.expire_at - self.created_at).days
    if diff_in_days == 7:
        return "1_week"
    else:
        return "1_month"
```
The result of this value(`diff_in_days`) is generally around 6.95. The value of 6 is accepted because it is questioned as the day. I needed a proper check here. I updated the query as 7 days or less.

```if diff_in_days <= 7:```

-  I also removed an unnecessary variable.

## 2 - Fixed : https://github.com/emre/dpoll.xyz/pull/69

- I've added table support at the backend. 

```md.markdown(value, extensions=['markdown.extensions.fenced_code', 'markdown.extensions.tables'])```

- I added the class to the table element for bootstrap framework.

``` $('table').addClass('table');``` ( I love jquery.)

#### Related pull requests

https://github.com/emre/dpoll.xyz/pull/58
https://github.com/emre/dpoll.xyz/pull/69
👍 , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,