Code Duplication    Length = 12-12 lines in 2 locations

app/cashflow.py 2 locations

@@ 157-168 (lines=12) @@
154
                                futuredate = futuredate.replace(day=futuredateday)
155
                    except ValueError:
156
                        pass
157
                if futuredate <= todaydate:
158
                    existing.startdate = futuredate + relativedelta(months=3)
159
                    daycheckdate = futuredate + relativedelta(months=3)
160
                    daycheck = daycheckdate.day
161
                    if firstdateday > daycheck:
162
                        try:
163
                            for m in range(3):
164
                                daycheck += 1
165
                                if firstdateday >= daycheck:
166
                                    existing.startdate = daycheckdate.replace(day=daycheck)
167
                        except ValueError:
168
                            pass
169
                total = Total(type=type, name=name, amount=amount, date=futuredate - pd.tseries.offsets.BDay(0))
170
                db.session.add(total)
171
        elif frequency == 'BiWeekly':
@@ 111-122 (lines=12) @@
108
                                futuredate = futuredate.replace(day=futuredateday)
109
                    except ValueError:
110
                        pass
111
                if futuredate <= todaydate:
112
                    existing.startdate = futuredate + relativedelta(months=1)
113
                    daycheckdate = futuredate + relativedelta(months=1)
114
                    daycheck = daycheckdate.day
115
                    if firstdateday > daycheck:
116
                        try:
117
                            for m in range(3):
118
                                daycheck += 1
119
                                if firstdateday >= daycheck:
120
                                    existing.startdate = daycheckdate.replace(day=daycheck)
121
                        except ValueError:
122
                            pass
123
                if type == 'Income':
124
                    rollbackdate = datetime.combine(futuredate, datetime.min.time())
125
                    total = Total(type=type, name=name, amount=amount,